Open Form Help

hootie318

Registered User.
Local time
Today, 18:10
Joined
Oct 28, 2003
Messages
130
I have several subforms on one form. They all have the same source, but I am trying to have each subform display different records. I figured what I could do is put a code in the On Open event. I just dont know how to write that. Subform A needs to display records where ID = 1. Subform B needs ID = 2, 3, 4. Subform C needs ID = 4, and Subform D needs ID = 5.
 
You need to create queries with the criteria in place that you want. You will need one query for each sub-form.

GumbyD
 
The record source is already a query.
 
Right - so you need to customize that query and save it multiple times once for each sub-form with the criteria for the specific sub-form. Then you need to change the recordsource for each of the sub-forms to the correct query.

GumbyD
 
Ok. I am duplicating the query. How do I enter the criteria for multiple options. One subform has to open for ID 2, 3, and 4.
=1 works for the first one. I tried =2,3,4 and that didnt work.
 
Put in 2 or 3 or 4 for the criteria

Field Name Your Field
Table Name Your Table

Criteria 2 or 3 or 4

GumbyD
 
Or, how about keeping the same query for all of the subforms and using a filter to select the records you want. This will save on maintenance if changes need to be made to the query.
 

Users who are viewing this thread

Back
Top Bottom