related records

  • Thread starter Thread starter margaret hannah
  • Start date Start date
M

margaret hannah

I posted this earlier, but let me see if I can clarify.

I have three tables ... TBLTickets; TBLTicketsSold;
TBLDiscounts. TBLTickets has a field "ID", as does the
other two. TBLDiscounts.id and TBLTicketsSold.id both
have a many side of the one relationship to TBLTickets.ID.

When I enter data on my form, I first enter on FRMTickets
the relavant info. Then I go to FRMTicketsSold. The
control is =Forms![FRM Tickets]!id for text box
TBLTickets_id. This automatically tells the
TBLTicketsSold that the id number is the same number as in
TBLTickets. This works fine for FRMTicketsSold. However,
when I do the same process for FRMDiscounts, it's telling
me I do not have the relevant information for
TBLTickets.id.

What would make this work in FRMTicketsSold and not
FRMDiscounts?
 
When I enter data on my form, I first enter on FRMTickets
the relavant info. Then I go to FRMTicketsSold. The
control is =Forms![FRM Tickets]!id for text box
TBLTickets_id. This automatically tells the
TBLTicketsSold that the id number is the same number as in
TBLTickets. This works fine for FRMTicketsSold. However,
when I do the same process for FRMDiscounts, it's telling
me I do not have the relevant information for
TBLTickets.id.

What would make this work in FRMTicketsSold and not
FRMDiscounts?

Again:

*Make FRMDiscounts a SUBFORM on FRMTickets*. Use ID as the Master Link
Field and the Child Link Field. Use the Toolbox "Subform/Subreport"
tool; put it onto your main form, or on a tab page on a Tab Control on
the form if you need the screen space; select the option "use an
existing form".

The way you're doing it is *not* a subform; you're popping up a
completely independent unrelated form. Setting the Control Source of a
textbox to =Forms![FRM Tickets]![ID] will display whatever is in that
control, but it will *not* store it in the Discounts table ID field; a
textbox can be bound to a field (ID) or to an expression (as yours
is), but *not both*.

If you have some very good reason to do it the hard way - using three
Event procedures - to do something which can be done with no code at
all using the builtin Subform feature, post back; it can be done (it's
just usually not worth the trouble!)


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top