selective data for combo box

C

Cheswyck

I'm collecting times for a customer/job database. In the
form, the customer and job codes are combo boxes. When
selecting the 'job' I only want to display the jobs that
relate to the customer which is the preceeding entry.
Customers and jobs have their own entry form and the job
table includes the customerID as a foreign key.
I think I want the SQL to say something like WHERE [job].
[customer] = [me].[customer] but when i get to the job
combo i get an error.
How should I handle this problem?
 
G

Graham Mandeno

Hi Cheswyck

SQL will not understand [Me].[customer], as Me is only valid within the
form's class module. You will need to specify the form entirely:
WHERE [job].[customer] = [Forms]![My Form]![customer]

Also, you will need to requery the combo box ([ComboName].Requery) every
time the customer changes (for example, in the Form_Current event).
 
S

Steven M. Britton

In the Row Source of the Combo Box use the query builder
to select the Job Codes and have a second field that has
the critera of [Forms]![NameofForm].[Customer]

I do the excat same thing and is works great.... Let me
know
 
C

Cheswyck

Thanks for your help. I've learned a lot from both of
you. I'll be able to move on to the next hurtle. It's
been a while and I'm a little rusty.
But now I have another question...
-----Original Message-----
In the Row Source of the Combo Box use the query builder
to select the Job Codes and have a second field that has
the critera of [Forms]![NameofForm].[Customer]

I do the excat same thing and is works great.... Let me
know
-----Original Message-----
I'm collecting times for a customer/job database. In the
form, the customer and job codes are combo boxes. When
selecting the 'job' I only want to display the jobs that
relate to the customer which is the preceeding entry.
Customers and jobs have their own entry form and the job
table includes the customerID as a foreign key.
I think I want the SQL to say something like WHERE [job].
[customer] = [me].[customer] but when i get to the job
combo i get an error.
How should I handle this problem?
.
.
 

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