Simple subforms query

freda42

Registered User.
Local time
Today, 13:14
Joined
Aug 3, 2004
Messages
25
I'm so sure this should be easy to do....but I can't figure it out!

I have two tables, with associated forms. One is company data (name, address etc), the other is enquiry data (date of enquiry, nature of enquiry etc). One company can make many enquiries, but each enquiry is only made by one company. I have the common field CompanyID in both tables (as the primary key in the company table) and a 1 to many relationship set up between the companyID fields (1 = company data, many = enquiry).

I want to design a form so that you can scroll through the enquiries in order 1 through to x, with the company that made the enquiry showing in a subform.

All I can get it to do is to bring up the company data sequentially, with the enquiry data in a subform! This means that you cannot scroll through all the enquiries from 1 to 100, you can only see the enquiries made by the selected company.

What should I be doing that I'm not doing?!

Thanks!
 
Last edited:
Using the OnCurrent Record event of the many form have it filter the subform based on the companyID.
 
Thanks, I think I see what you mean. I know what the OnCurrent event is, but I don't know anything about filters. Do I have to filter it by writing some code? Where can I find out more about filters?
 
One place to look up filters is access help. Also look up SQL.

But here's a rundown on basic filters. It's the Where clause of SQL without the Where word inserted. So say you want to filter by a certain state:

State='NY'

In your code you'd need to surround that entire line with double quotes.

For a number:

ID=500

For a date:

Date=#10/14/2004#

Notice that text is surrounded by single quotes, dates by pound signs and numbers by nothing.

Hope that helps.
 

Users who are viewing this thread

Back
Top Bottom