Refreshing ComboBoxB with new criteria in ComboBoxA

H

HKKS

Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list of
customers from a company selected from combo box "cboCompanyName". Only the
customers appear from the selected company. When I select a different company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it doesn't - it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but haven't found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 
J

Jeanette Cunningham

Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
H

HKKS

Hi Jeanette,

Thanks for your advice. I do have a CompanyID field as you said but I'm not
sure if it's a bound column of cboCompanyName. In the bound column field it
only has a number, which is "1", so I can't enter "CompanyID". CompanyID is
the first row in my Company table. Is this related?

I did take away the "And (Customer.Company)=[Company]" as you suggested but
still no luck. Would you have any other ideas what could be keeping combos
from refreshing?

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


HKKS said:
Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list of
customers from a company selected from combo box "cboCompanyName". Only
the
customers appear from the selected company. When I select a different
company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it doesn't - it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but haven't
found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 
J

Jeanette Cunningham

Looking more closely at the query, the syntax is not quite correct.
I assume you have this query in vba and are not using a saved query. Is this
correct?

From your reply about the bound column, yes, CompanyID is the bound field
for cboCompanyName, so that bit is correct.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

HKKS said:
Hi Jeanette,

Thanks for your advice. I do have a CompanyID field as you said but I'm
not
sure if it's a bound column of cboCompanyName. In the bound column field
it
only has a number, which is "1", so I can't enter "CompanyID". CompanyID
is
the first row in my Company table. Is this related?

I did take away the "And (Customer.Company)=[Company]" as you suggested
but
still no luck. Would you have any other ideas what could be keeping combos
from refreshing?

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


HKKS said:
Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list of
customers from a company selected from combo box "cboCompanyName". Only
the
customers appear from the selected company. When I select a different
company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it doesn't -
it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but haven't
found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 
H

HKKS

Hi Jeanette,

I do have a saved query named "unqCompanyToCustomer", but this query is only
to remove duplicate company names from the combo box list. I couldn't create
VBA code to save my life, but I'm learning.

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Looking more closely at the query, the syntax is not quite correct.
I assume you have this query in vba and are not using a saved query. Is this
correct?

From your reply about the bound column, yes, CompanyID is the bound field
for cboCompanyName, so that bit is correct.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

HKKS said:
Hi Jeanette,

Thanks for your advice. I do have a CompanyID field as you said but I'm
not
sure if it's a bound column of cboCompanyName. In the bound column field
it
only has a number, which is "1", so I can't enter "CompanyID". CompanyID
is
the first row in my Company table. Is this related?

I did take away the "And (Customer.Company)=[Company]" as you suggested
but
still no luck. Would you have any other ideas what could be keeping combos
from refreshing?

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list of
customers from a company selected from combo box "cboCompanyName". Only
the
customers appear from the selected company. When I select a different
company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it doesn't -
it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but haven't
found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 
J

Jeanette Cunningham

You have a combo for Company name and 2 combos for customers?

Would you post the tables that the form is based on and the tables the
combos are based on.

What is the purpose of cboCustomer2 and why is it needed - can't you get
all the people for the company chosen in cboCompany and show them in
cboCustomer1?


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


HKKS said:
Hi Jeanette,

I do have a saved query named "unqCompanyToCustomer", but this query is
only
to remove duplicate company names from the combo box list. I couldn't
create
VBA code to save my life, but I'm learning.

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Looking more closely at the query, the syntax is not quite correct.
I assume you have this query in vba and are not using a saved query. Is
this
correct?

From your reply about the bound column, yes, CompanyID is the bound field
for cboCompanyName, so that bit is correct.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

HKKS said:
Hi Jeanette,

Thanks for your advice. I do have a CompanyID field as you said but I'm
not
sure if it's a bound column of cboCompanyName. In the bound column
field
it
only has a number, which is "1", so I can't enter "CompanyID".
CompanyID
is
the first row in my Company table. Is this related?

I did take away the "And (Customer.Company)=[Company]" as you suggested
but
still no luck. Would you have any other ideas what could be keeping
combos
from refreshing?

Thanks
--
HKKS
Tokyo, Japan


:

Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is
the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list
of
customers from a company selected from combo box "cboCompanyName".
Only
the
customers appear from the selected company. When I select a
different
company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it
doesn't -
it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but
haven't
found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 
H

HKKS

Hi Jeanette,

It may sound a bit strange what I'm doing. The "customers" are actually
students. So, what I am doing is this: User selects a Company and up to 12
students in that company (new class starts). All the class information
(texts, trainers, class name, etc) is automatically updated into each
students' records rather then find each student individually and updating.

Select Company
Select Student1, Student2, Student3, etc
Click "update" button

But, if you select the wrong company at first the Student1 combo box doesn't
refresh. It will lead to confusion I'm sure.
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
You have a combo for Company name and 2 combos for customers?

Would you post the tables that the form is based on and the tables the
combos are based on.

What is the purpose of cboCustomer2 and why is it needed - can't you get
all the people for the company chosen in cboCompany and show them in
cboCustomer1?


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


HKKS said:
Hi Jeanette,

I do have a saved query named "unqCompanyToCustomer", but this query is
only
to remove duplicate company names from the combo box list. I couldn't
create
VBA code to save my life, but I'm learning.

Thanks
--
HKKS
Tokyo, Japan


Jeanette Cunningham said:
Looking more closely at the query, the syntax is not quite correct.
I assume you have this query in vba and are not using a saved query. Is
this
correct?

From your reply about the bound column, yes, CompanyID is the bound field
for cboCompanyName, so that bit is correct.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Hi Jeanette,

Thanks for your advice. I do have a CompanyID field as you said but I'm
not
sure if it's a bound column of cboCompanyName. In the bound column
field
it
only has a number, which is "1", so I can't enter "CompanyID".
CompanyID
is
the first row in my Company table. Is this related?

I did take away the "And (Customer.Company)=[Company]" as you suggested
but
still no luck. Would you have any other ideas what could be keeping
combos
from refreshing?

Thanks
--
HKKS
Tokyo, Japan


:

Hi HKKS
change the query so that it only looks in one place for the company.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.CompanyID)=[Forms]![Customer]![cboCompanyName])));

Assuming that you have a field called CompanyID and that CompanyID is
the
bound column of cboCompanyName.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hello,
I have combo boxes "cboCustomer1" & "cboCustomer2" that have a list
of
customers from a company selected from combo box "cboCompanyName".
Only
the
customers appear from the selected company. When I select a
different
company
for "cboCustomer2" related customers appear. However, I would like
"cboCustomer1" to reflect the newly chosen company, which it
doesn't -
it
does not requery or refresh the list.

How can I get it to do this? I've looked on numerous posts but
haven't
found
a similar problem. Here is my query if it's helpful.

SELECT Customer.LastName & ", " & Customer.FirstName FROM Customer
WHERE (((Customer.Company)=[Forms]![Customer]![cboCompanyName] And
(Customer.Company)=[Company]));

Thank you in advance for your much needed help.
 

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