dbTalk Databases Forums  

Subform based on query

comp.database.ms-access comp.database.ms-access


Discuss Subform based on query in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fbradley
 
Posts: n/a

Default Subform based on query - 07-19-2004 , 11:34 AM






I have a subform based on a query. I use a dropdown list to pull up
records on the main form. I would like to have the subform/query
requery each time a new record is pulled up.

Can anyone give some advice?

Thanks

Reply With Quote
  #2  
Old   
King Ron
 
Posts: n/a

Default Re: Subform based on query - 07-20-2004 , 12:44 PM






Ola Frank:

If you have the Master/Child relationship set in the subform's
Properties/Data/ tab, the subform recordset will automatically be
filtered to display only those records related to the master record ID
currently in context.

The Master record Key must be a field in the Child form's Record
source and the Master/Child relationship set between these two fields:

Forms("MasterForm").RecordSource = "SELECT *.* FROM MasterTable"
Forms("ChildForm").Recordsource = "SELECT *.* FROM ChildTable"

Form("MasterForm").sfmChildSubform.LinkChildFields := chMasterID
Form("MasterForm").sfmChildSubform.LinkMasterField s:= maID

where 'maID' is the master record key and 'chMasterID' is the child
record's pointer the the related master.

By doing this you can remove any criteria from the subform's
RecordSource query and let access keep the records in synch.


Rich Harrington
Chi



frankbradley (AT) insightbb (DOT) com (Fbradley) wrote in message news:<8e6887e6.0407190834.64644c2 (AT) posting (DOT) google.com>...
Quote:
I have a subform based on a query. I use a dropdown list to pull up
records on the main form. I would like to have the subform/query
requery each time a new record is pulled up.

Can anyone give some advice?

Thanks

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.