Populating combo and listboxes

chobo321321

Registered User.
Local time
Today, 08:27
Joined
Dec 19, 2004
Messages
53
Hi, I haven't touched access in a awhile, and forgot quite a bit :( I was wondering what is he most simple, and effective way of using one combo or listbox value to populate another combo or listbox?

I'm not even sure if I have to create a connection, and recordset. I recall there was a few ways of doing this. At the moment I am using the "afterupdate" event on the first combo box, which contains the following code.

Code:
Private Sub cboEmployee_AfterUpdate()
Dim strSQL As String
    strSQL = "Select Emp_ID"
    strSQL = strSQL & " from tblEmployees where Emp_ID = &cboEmployee"
    Me!cboList.RowSourceType = "Table/Query"
    Me!cboList.RowSource = strSQL
End Sub

Thanks in advance.
 
Plus a Requery command to refresh the control, that's one way.
I usually just base the control on a query that pulls the parm from the other control. Then I only have to requery the control to refresh it and it's a lot less code. Proabably a couple more ways to handle it also.
 
Thats it. .
 
I'd love to try your way FoFa, but I don't quite follow. COuld you post a simple little example. Thanks
 

Users who are viewing this thread

Back
Top Bottom