Sync Multiple Combo Boxes

G

Guest

I have four Combo Boxes:
Customers, Contacts, Project Managers, and Superintendents

The other three Combo Box values are based on what is selected in Customers
using a SQL statement. For example The Contancts SQL statement is:

SELECT [Customer Contacts Table].CC_CustomerContactID, [Customer Contacts
Table].[CC_Contact Person], [Customer Contacts Table].CC_Company FROM
[Customer Contacts Table] WHERE ((([Customer Contacts
Table].CC_Company)=Forms![Job Work Order Form]!Customer)) ORDER BY [Customer
Contacts Table].[CC_Contact Person];

I know that I need code in the Customers Field. This is what I have:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
End Sub

How can I alter the code to requery all three fields instead of just the
one? I tried adding more After Event Codes using the other field names and
the computer exploded! :)
 
G

Guest

I'm a dork...

I changed my code to this and it appears to work:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
Me.Project_Manager = Null
Me.Project_Manager.Requery
Me.Project_Manager = Null
Me.Project_Superintendent = Null
Me.Project_Superintendent.Requery
Me.Project_Superintendent = Null
End Sub

If one of the pros could confirm though, that would be great!
 
G

Guest

You don't the to set the value of the combos to null before the requeries,
only after and only if you want them empty after the requery. Other than
that, you got it.

Christian > said:
I'm a dork...

I changed my code to this and it appears to work:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
Me.Project_Manager = Null
Me.Project_Manager.Requery
Me.Project_Manager = Null
Me.Project_Superintendent = Null
Me.Project_Superintendent.Requery
Me.Project_Superintendent = Null
End Sub

If one of the pros could confirm though, that would be great!

Christian > said:
I have four Combo Boxes:
Customers, Contacts, Project Managers, and Superintendents

The other three Combo Box values are based on what is selected in Customers
using a SQL statement. For example The Contancts SQL statement is:

SELECT [Customer Contacts Table].CC_CustomerContactID, [Customer Contacts
Table].[CC_Contact Person], [Customer Contacts Table].CC_Company FROM
[Customer Contacts Table] WHERE ((([Customer Contacts
Table].CC_Company)=Forms![Job Work Order Form]!Customer)) ORDER BY [Customer
Contacts Table].[CC_Contact Person];

I know that I need code in the Customers Field. This is what I have:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
End Sub

How can I alter the code to requery all three fields instead of just the
one? I tried adding more After Event Codes using the other field names and
the computer exploded! :)
 
G

Guest

K. Thanks again!

Klatuu said:
You don't the to set the value of the combos to null before the requeries,
only after and only if you want them empty after the requery. Other than
that, you got it.

Christian > said:
I'm a dork...

I changed my code to this and it appears to work:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
Me.Project_Manager = Null
Me.Project_Manager.Requery
Me.Project_Manager = Null
Me.Project_Superintendent = Null
Me.Project_Superintendent.Requery
Me.Project_Superintendent = Null
End Sub

If one of the pros could confirm though, that would be great!

Christian > said:
I have four Combo Boxes:
Customers, Contacts, Project Managers, and Superintendents

The other three Combo Box values are based on what is selected in Customers
using a SQL statement. For example The Contancts SQL statement is:

SELECT [Customer Contacts Table].CC_CustomerContactID, [Customer Contacts
Table].[CC_Contact Person], [Customer Contacts Table].CC_Company FROM
[Customer Contacts Table] WHERE ((([Customer Contacts
Table].CC_Company)=Forms![Job Work Order Form]!Customer)) ORDER BY [Customer
Contacts Table].[CC_Contact Person];

I know that I need code in the Customers Field. This is what I have:

Private Sub Customer_AfterUpdate()
Me.Contact_Person = Null
Me.Contact_Person.Requery
Me.Contact_Person = Null
End Sub

How can I alter the code to requery all three fields instead of just the
one? I tried adding more After Event Codes using the other field names and
the computer exploded! :)
 

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