I want Combo box to be populated depending on customer category

S

Sue R

When a customer number is entered on my form, the data populates the form,
including the text box for the customer category.

I want a combo box on that form to display only choices for that category.

How do I modify the query that runs the row source for the combo box?

Thanks,

Sue
 
T

Tom van Stiphout

On Thu, 7 Jan 2010 21:47:01 -0800, Sue R

The RowSource should be something like:
select * from Choices
where Category = Forms!myForm!myCategoryTextbox

-Tom.
Microsoft Access MVP
 
S

Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head is
getting sore!

Sue
 
J

John W. Vinson

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head is
getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of the
ClientContract control.
 
S

Sue R

Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract number
populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo box for
'project code' choices. There are hundreds of project codes, but I only want
the project codes selected to be those that have the same contract number
that the client has in the 'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




John W. Vinson said:
In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head is
getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of the
ClientContract control.
 
M

Mike Painter

Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and MTR]!ClientContract))
"

This is only part of a query.
Where is the SELECT part?



Sue said:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo box
for 'project code' choices. There are hundreds of project codes, but
I only want the project codes selected to be those that have the same
contract number that the client has in the 'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




John W. Vinson said:
In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head
is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of
the ClientContract control.
 
S

Sue R

Thanks for the quick response. Here is the exact code from the Row Source in
the codebox property. (I removed the '(([UNITCOST BY CONTRACT].Dept)="MH")',
as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY CONTRACT].CONTRACT
FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT] ON MTR_Entry.Contract =
[UNITCOST BY CONTRACT].CONTRACT ORDER BY [UNITCOST BY CONTRACT].Service;

Sue

Mike Painter said:
Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and MTR]!ClientContract))
"

This is only part of a query.
Where is the SELECT part?



Sue said:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo box
for 'project code' choices. There are hundreds of project codes, but
I only want the project codes selected to be those that have the same
contract number that the client has in the 'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




John W. Vinson said:
On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head
is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of
the ClientContract control.


.
 
M

Mike Painter

Did you requery the combobox after entering a value in ClientContact?
If so, which event did you use?
Sue said:
Thanks for the quick response. Here is the exact code from the Row
Source in the codebox property. (I removed the '(([UNITCOST BY
CONTRACT].Dept)="MH")', as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY
CONTRACT].CONTRACT FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT] ON
MTR_Entry.Contract = [UNITCOST BY CONTRACT].CONTRACT ORDER BY
[UNITCOST BY CONTRACT].Service;

Sue

Mike Painter said:
Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract)) "

This is only part of a query.
Where is the SELECT part?



Sue said:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo
box for 'project code' choices. There are hundreds of project
codes, but I only want the project codes selected to be those that
have the same contract number that the client has in the
'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by
Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




:

On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head
is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of
the ClientContract control.


.
 
S

Sue R

Yes, I put a macro to requery the Combo box 'Codebox' in the after update
event of the ClientContract text box.

Mike Painter said:
Did you requery the combobox after entering a value in ClientContact?
If so, which event did you use?
Sue said:
Thanks for the quick response. Here is the exact code from the Row
Source in the codebox property. (I removed the '(([UNITCOST BY
CONTRACT].Dept)="MH")', as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY
CONTRACT].CONTRACT FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT] ON
MTR_Entry.Contract = [UNITCOST BY CONTRACT].CONTRACT ORDER BY
[UNITCOST BY CONTRACT].Service;

Sue

Mike Painter said:
Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract)) "

This is only part of a query.
Where is the SELECT part?



Sue R wrote:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo
box for 'project code' choices. There are hundreds of project
codes, but I only want the project codes selected to be those that
have the same contract number that the client has in the
'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by
Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




:

On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my head
is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event of
the ClientContract control.
--

John W. Vinson [MVP]
.


.


.
 
M

Mike Painter

Is this box bound to anything? If not I don't think it triggers. Try OnExit.

Sue said:
Yes, I put a macro to requery the Combo box 'Codebox' in the after
update event of the ClientContract text box.

Mike Painter said:
Did you requery the combobox after entering a value in ClientContact?
If so, which event did you use?
Sue said:
Thanks for the quick response. Here is the exact code from the Row
Source in the codebox property. (I removed the '(([UNITCOST BY
CONTRACT].Dept)="MH")', as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY
CONTRACT].CONTRACT FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT]
ON MTR_Entry.Contract = [UNITCOST BY CONTRACT].CONTRACT ORDER BY
[UNITCOST BY CONTRACT].Service;

Sue

:

Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract)) "

This is only part of a query.
Where is the SELECT part?



Sue R wrote:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo
box for 'project code' choices. There are hundreds of project
codes, but I only want the project codes selected to be those that
have the same contract number that the client has in the
'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by
Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




:

On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my
head is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event
of the ClientContract control.
--

John W. Vinson [MVP]
.


.


.
 
S

Sue R

The text box is autofilled when the customer number is first entered. It is
really only for display purposes, and to use as a reference for the combo box.

Mike Painter said:
Is this box bound to anything? If not I don't think it triggers. Try OnExit.

Sue said:
Yes, I put a macro to requery the Combo box 'Codebox' in the after
update event of the ClientContract text box.

Mike Painter said:
Did you requery the combobox after entering a value in ClientContact?
If so, which event did you use?
Sue R wrote:
Thanks for the quick response. Here is the exact code from the Row
Source in the codebox property. (I removed the '(([UNITCOST BY
CONTRACT].Dept)="MH")', as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY
CONTRACT].CONTRACT FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT]
ON MTR_Entry.Contract = [UNITCOST BY CONTRACT].CONTRACT ORDER BY
[UNITCOST BY CONTRACT].Service;

Sue

:

Below you say "In the Row Source for the combo box I have entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract)) "

This is only part of a query.
Where is the SELECT part?



Sue R wrote:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's contract
number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a combo
box for 'project code' choices. There are hundreds of project
codes, but I only want the project codes selected to be those that
have the same contract number that the client has in the
'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by
Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




:

On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my
head is getting sore!

YOu may also need to Requery this combo in the AfterUpdate event
of the ClientContract control.
--

John W. Vinson [MVP]
.


.


.


.
 
M

Mike Painter

"Autofilled"!? This should have been mentioned some time ago.
Then you need to requery the combo-box from where ever that value comes
from.

Sue said:
The text box is autofilled when the customer number is first entered.
It is really only for display purposes, and to use as a reference for
the combo box.

Mike Painter said:
Is this box bound to anything? If not I don't think it triggers. Try
OnExit.

Sue said:
Yes, I put a macro to requery the Combo box 'Codebox' in the after
update event of the ClientContract text box.

:

Did you requery the combobox after entering a value in
ClientContact? If so, which event did you use?
Sue R wrote:
Thanks for the quick response. Here is the exact code from the Row
Source in the codebox property. (I removed the '(([UNITCOST BY
CONTRACT].Dept)="MH")', as I didn't really need it.)

SELECT DISTINCTROW [UNITCOST BY CONTRACT].Service, [UNITCOST BY
CONTRACT].NAME, [UNITCOST BY CONTRACT].UNITP, [UNITCOST BY
CONTRACT].CONTRACT FROM MTR_Entry LEFT JOIN [UNITCOST BY CONTRACT]
ON MTR_Entry.Contract = [UNITCOST BY CONTRACT].CONTRACT ORDER BY
[UNITCOST BY CONTRACT].Service;

Sue

:

Below you say "In the Row Source for the combo box I have
entered:"

" WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract)) "

This is only part of a query.
Where is the SELECT part?



Sue R wrote:
Still no luck,

Maybe more info will help.

My form is 'Monthly Input Invoice and MTR'

The client number is entered in the form and the client's
contract number populates the text box called 'ClientContract'

The further down on the form, I want the user to click on a
combo box for 'project code' choices. There are hundreds of
project codes, but I only want the project codes selected to be
those that have the same contract number that the client has in
the 'ClientContract' text box.

The project codes are stored in a table called 'Unitcost by
Contract'.

I hope this helps, I am going nuts trying to figure this out.

Thanks in advance!

Sue




:

On Fri, 8 Jan 2010 17:00:01 -0800, Sue R

In the Row Source for the combo box I have entered:

WHERE ((([UNITCOST BY CONTRACT].Dept)="MH") AND (([UNITCOST BY
CONTRACT].CONTRACT)=Forms![Monthly Input Invoice and
MTR]!ClientContract))

It still doesn't work. Help, I am pulling my hair out and my
head is getting sore!

YOu may also need to Requery this combo in the AfterUpdate
event of the ClientContract control.
--

John W. Vinson [MVP]
.


.


.


.
 

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