subform question

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

What is the proper way to code the following situation:

I have a main form that displays subform records, no problem. But then I
need an ADDITIONAL subform that uses the record selected from the first
subform as criteria. How do I properly reference the record selected on the
forst subform as the link to the second subform?

Thanks

- joe
 
What is the proper way to code the following situation:

I have a main form that displays subform records, no problem. But then I
need an ADDITIONAL subform that uses the record selected from the first
subform as criteria. How do I properly reference the record selected on the
forst subform as the link to the second subform?

Two ways:

- have the first subform in Single view (rather than datasheet or
continuous), and embed the second subform on the first subform.

- Undocumented to my knowledge but it works: use the *FULLY QUALIFIED*
control name of the record ID on the first subform as the Master Link
Field property of the second subform:

[Forms]![Mainformname]![subform1].Form![txtID]

The Child Link Field should just be the name of the linking field in
the second subform's recordsource (not a control name).
 
John
Can you elaborate more on your suggestion below
I've been struggling for 2 days for this
I've got Form,subform,listbox (as lvl3 subform) and when user double click the listbox it opens the entry form for the lvl 3 subform, but the linking fields fails if there is no records exist(error: Primary key cannot contain null value). Funny thing is that you can add new record if at least 1 record already exist in the table ( I purposely add manually)

Please help me, thanks

_djoez


----- John Vinson wrote: ----

On Mon, 8 Mar 2004 10:30:11 -0500, "Joe Williams" <[email protected]
wrote

- Undocumented to my knowledge but it works: use the *FULLY QUALIFIED
control name of the record ID on the first subform as the Master Lin
Field property of the second subform

[Forms]![Mainformname]![subform1].Form![txtID

The Child Link Field should just be the name of the linking field i
the second subform's recordsource (not a control name)

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=publi
 
John,
Can you elaborate more on your suggestion below?
I've been struggling for 2 days for this.
I've got Form,subform,listbox (as lvl3 subform) and when user double click the listbox it opens the entry form for the lvl 3 subform, but the linking fields fails if there is no records exist(error: Primary key cannot contain null value). Funny thing is that you can add new record if at least 1 record already exist in the table ( I purposely add manually).

I think you're using "subform" for a popup form; you don't "open an
entry form" for a Subform, and "a listbox as lvl3 subform" makes no
sense: a listbox is not a form.

Could you explain what Forms you have, with their recordsource
properties, master/child links on the subforms, and the code that
you're using? You say the "linking fields fails if there is no records
exist" - no records in which table?
 
Back
Top