Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Afterupdate- Change values in combo box based on selection in another

Status
Not open for further replies.

jprochelle

Technical User
Jun 18, 2004
36
0
0
US
I have two combo boxes. I want to do an afterupdate so that after one selection is made in the first combo box, the second combo box automatically "repopulates" with new data based on this selection. I think it will be similar to an AFTERUPDATE...requery..but it's not a query, just new data.

Thanks.

Rochelle
 
What is the RowSource of the second ListBox ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Right now the row source is based on a query:

SELECT ClientsImport.CID, ClientsImport.Name, ClientsImport.Banker FROM ClientsImport GROUP BY ClientsImport.CID, ClientsImport.Name, ClientsImport.Banker HAVING (((ClientsImport.Banker)=Forms![Edit TOP 10]!cboBanker));

This was what I thought I could do, but didn't work. I am taking the CID & Name from Clients Import Table based on the Banker selected in the cboBanker combo box.
 
Have you tried [name of 2nd combo].Requery in the AfterUpdate event procedure of cboBanker ?
If yes and to no avail, you may try this in the AfterUpdate event procedure of cboBanker:
[name of 2nd combo].RowSource = "SELECT DISTINCT CID,[Name],Banker FROM ClientsImport WHERE Banker='" & cboBanker & "';"
[name of 2nd combo].Requery
If Banker is defined as numeric in the ClientsImport table then get rid of the single quotes.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks- this worked great. However, now whenever I try to change and add new records...the two combo boxes stay the same for each record..instead of being saved as the ones that I chose..

Do i have to delete what's in the row source for the 2nd combo box? Is that why's it's getting confused?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top