Using a control field in a form with a subform.

  • Thread starter quinto via AccessMonster.com
  • Start date
Q

quinto via AccessMonster.com

I am trying to use the following in a form wirth a subform but it does not
work. [Forms]![TripsMain]![MemberNumber]
Any suggestions?

Quinto
 
J

John W. Vinson

I am trying to use the following in a form wirth a subform but it does not
work. [Forms]![TripsMain]![MemberNumber]
Any suggestions?

Quinto

The syntax for referring to a control on a subform is a bit peculiar. The
Subform is not a member of the Forms collection, as it is not open in its own
right; it's only there as a property of the subform control.

You need to use the Name property *of the Subform control* - which may or may
not be the same as the name of the form within that control; the syntax is

=Forms![Mainform]![Subformcontrol].Form![controlname]

So if the mainform is named TripsMain; the Subform control (the box containing
the form) is named sbfMemberTrips; the form you're using as a subform named
MemberTrips, or MySubform, or PeachesAndCream or anything else; and a control
on that form named MemberNumber,

[Forms]![TripsMain]![sbmMemberTrips].Form![MemberNumber]

should get it for you.
 
Q

quinto via AccessMonster.com

The control field I want to use is in the main form, What I am tring to do is
to use an append query to transfer the information to the subform table
without having to type in the number.

Thanks

Quinto
I am trying to use the following in a form wirth a subform but it does not
work. [Forms]![TripsMain]![MemberNumber]
Any suggestions?

Quinto

The syntax for referring to a control on a subform is a bit peculiar. The
Subform is not a member of the Forms collection, as it is not open in its own
right; it's only there as a property of the subform control.

You need to use the Name property *of the Subform control* - which may or may
not be the same as the name of the form within that control; the syntax is

=Forms![Mainform]![Subformcontrol].Form![controlname]

So if the mainform is named TripsMain; the Subform control (the box containing
the form) is named sbfMemberTrips; the form you're using as a subform named
MemberTrips, or MySubform, or PeachesAndCream or anything else; and a control
on that form named MemberNumber,

[Forms]![TripsMain]![sbmMemberTrips].Form![MemberNumber]

should get it for you.
 
J

John W. Vinson

The control field I want to use is in the main form, What I am tring to do is
to use an append query to transfer the information to the subform table
without having to type in the number.

Well... that's not what you asked for. You said

I am trying to use the following in a form wirth a subform but it does not
work. [Forms]![TripsMain]![MemberNumber]

without explaining what you meant by "use" or "does not work". Sorry my
telepathy wasn't working correctly!


Please explain what you're trying to accomplish; the relevant parts of your
table data structure; the recordsources of your form and subform; the
master/child link field properties of the subform; and why you feel that you
need to apparantly store data redundantly in the two tables.
 
Q

quinto via AccessMonster.com

Thanks for your patience.
I have a table that contains clients to be transported daily, they are
grouped by route and appointment time . The clients to be transporteed may
differ from day to day, the appointment time and destination may also changed.
I receive a file daily that I will compare to the master file and identify
any deviation form the set routes. The 2 table are linked with queries and
the common control is the Member Number. When I receive new clients they get
added to the Trips Master table and the pick up time is calculated and they
are assigned to a routes. Fields from both tables are used to generate
drivers manifests. I display the 2 tables side by side. TripsMaster is the
main form and the TripsSched the subform. Occasionally I get a fax to add a
trip to the TripsSched and rather then type the information I want to add the
part from the TripsMaster by using the aleady set up queeries. The problem is
that the the linking field must be identified 4 times because I use 4
different queries, Each trip is received as one record, one line. I will
devide this into 4 parts. PickUp, DropOff, in the return trips the addresses
are reversed and the preassigned times used. 4 diferent actions are listed
in the mainifests in time order. You have given me direction on how to use
the Tex Box in a form for this type of action I could leave the form and use
a diferent form to make it work but I wonder if I can do it from the main
form. The Member number is already dispalayed in both form but it would not
be too bad if I have to add a text box and type in the number for the client
being added..

Thanks

Quinto
The control field I want to use is in the main form, What I am tring to do is
to use an append query to transfer the information to the subform table
without having to type in the number.

Well... that's not what you asked for. You said

I am trying to use the following in a form wirth a subform but it does not
work. [Forms]![TripsMain]![MemberNumber]

without explaining what you meant by "use" or "does not work". Sorry my
telepathy wasn't working correctly!

Please explain what you're trying to accomplish; the relevant parts of your
table data structure; the recordsources of your form and subform; the
master/child link field properties of the subform; and why you feel that you
need to apparantly store data redundantly in the two tables.
 
Q

quinto via AccessMonster.com

I left out that the memebr number is used to select the record from the
TripsMaster to be added to the TripsSched.

Quinto
Thanks for your patience.
I have a table that contains clients to be transported daily, they are
grouped by route and appointment time . The clients to be transporteed may
differ from day to day, the appointment time and destination may also changed.
I receive a file daily that I will compare to the master file and identify
any deviation form the set routes. The 2 table are linked with queries and
the common control is the Member Number. When I receive new clients they get
added to the Trips Master table and the pick up time is calculated and they
are assigned to a routes. Fields from both tables are used to generate
drivers manifests. I display the 2 tables side by side. TripsMaster is the
main form and the TripsSched the subform. Occasionally I get a fax to add a
trip to the TripsSched and rather then type the information I want to add the
part from the TripsMaster by using the aleady set up queeries. The problem is
that the the linking field must be identified 4 times because I use 4
different queries, Each trip is received as one record, one line. I will
devide this into 4 parts. PickUp, DropOff, in the return trips the addresses
are reversed and the preassigned times used. 4 diferent actions are listed
in the mainifests in time order. You have given me direction on how to use
the Tex Box in a form for this type of action I could leave the form and use
a diferent form to make it work but I wonder if I can do it from the main
form. The Member number is already dispalayed in both form but it would not
be too bad if I have to add a text box and type in the number for the client
being added..

Thanks

Quinto
[quoted text clipped - 12 lines]
master/child link field properties of the subform; and why you feel that you
need to apparantly store data redundantly in the two tables.
 
Top