I also have a question about main and subform !!

G

Guest

Hi

I have a main with qry1 and subform with qry2. They are linked up by field1 and field2. In my main, I have field1 and field2 as controls. Both field1 and field2 are combo boxes. What I am trying to do is, when field1 is selected, use field1 to restrict field2 and then use field1+field2 to restrict the recordset in subform. For example
field1 = department
field2 = salesman
subform = displays all orders of the salesma

I will choose field1 first and then use field1 to filter field2 so that I can see salesmans of the particular deaprtment. When a salesman is chosen, all orders belong to this saleman will display in the subform

Does anyone have come aross this situation

Thank
 
J

Jeff Boyce

Jim

In the AfterUpdate event of your first combo box, add in something like:

Me!SecondComboBox.Requery

to refresh the list displayed by the second combo box. That second combo
box's query needs to "point" to the first combo box as a criterion for the
salesman's department. Use, as a criterion, something like:

Forms!YourFormName!YourFirstComboBoxName

to pass the choice of the first combo box to the query that sets the second.

If your subform is using the appropriate fields for the parent/child
property values, selecting a salesman in the second combo box should give
the subform what it needs to find related records.
 
J

Jeff Boyce

Jim

From your description, it sounds like the query underlying your subform
doesn't understand what it's to do. How do you set the subform's source?
 
G

Guest

Hi Jeff, Thanks for your reply.
Let's forget this thread as I believe we cannot fully program subform comparing to IBM CICS or Oralce.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top