getting subform to display records associated to main form

G

Guest

I have a form that displays projects with a sub form to display letters
(email) associated to each project. The projects are displaying but the
letters are not.

form1 queries for projectid, project_description, phaseid,
phase_description, processid, process_description. form1 source is a query
that queries for these fields. projectid, phaseid and processid are in
separate tables with their respective descriptions (projectstbl, phasetbl,
processtbl).

subform form2 should query letters based on projectid, phaseid and
process_id from main form but doesn't. form2 source is a query based on
projectid, phaseid and processid from form1. The fields displayed in form2
are from lttrstbl.

Form1 has scroll bar that steps through all the projectids with their
associated info. No records are displayed in form2 while steping through
form1. Nothing is displayed in form2.

Here are the criteria for form2 query:
[Form]![QueryProjectPhaseStage]![Projid]
[Form]![QueryProjectPhaseStage]![Phase]
[Form]![QueryProjectPhaseStage]![Stage_of_process]

What do I need to do to get this to work?
Thanks in advance for your help!
 
G

Guest

You don't say if you have a master-child link between the main form and the
subform but I gather you don't.

Try this. In the main form's On_Current event (I'm assuming its a
continuous form):
Me!Form1.Form.Requery

This should cause the subform to perform its query again with the new
criteria from the main form.

Tom
 
G

Guest

Thanks so much for replying.
I tried typeing Me!form1.form.requery, me!form2.form.requery,
me!form1.form2.requery and me!form2.form1.query and each time a message
appeared stating that it couldn't find the macro. I went to the envent
builder and typed the same things in and it couldn't find it as a field.
Any other suggestions?
What do you mean by master-child link?
What do you mean by continuous form?
 
G

Guest

OK, I think I accidentally mislead you a bit.

The code I gave you belongs in the VBA editor within the main form's Current
event. In the main form's Properties window, in the Event tab, the On
Current line should have [Event Procedure] in it.
 

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