Full Version: controlling the row source of one combo box from a seperate combo box
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
ben2203
Hi All,

I have this piece of code:

SELECT DISTINCT tbl_collectBills.Truck, tbl_collectBills.Branch
FROM tbl_collectBills
WHERE (((tbl_collectBills.Branch)=forms!frmCollectBills.cboSelectBranch))
ORDER BY tbl_collectBills.Truck;

on the row source of a combo box

Basically, it selects all relevant truck numbers related to the branch, trouble is when I select one branch the truck numbers for that branch come up but if I change the branch I am still left with the initial values from selecting the branch previously ( I hope you're still with me).

I need a way of refreshing the combo boxes row source when the branch is updated, I'm a little stuck

do I have to use me. to reference the control then me.requery? Along those lines?

Thanks in Advance
trapperalexander
try this...

in the AfterUpdate event of your combobox that selects a branch put this code:

me.ComboTruckNumbers.Requery
ben2203
yeah, I worked it out in the end, thanks very much, the answer came to me, just haven't done much of access for a while so kind of not up to speed with it, thanks again.
trapperalexander
glad you got it working! thumbup.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.