populating a dropdown based on Client id selected

B

babs

Below is the code that I have tied to the after update event of Client id. I
only want to see the pickupyd and delivyd for the given Clientid for the drop
down list of the form. For some reason the pickupyd field is a number field
NOT text and my drop down is not displaying correctly- getting 1 2 3
instead of the actual pickupyd(number) ex. 889 or 7348. Not sure why- is it
something to do with the syntax below????? No idea.


Private Sub cboClientId_AfterUpdate()
Dim lSql As String
Dim mSql As String

'This function sets the RowSource of ClientId, based on the value selected
in ClientId
lSql = "SELECT Distinct Pickupyd,Clientid " & "FROM tbltanksrate " & "WHERE
ClientId = """ & Me.cboClientId & """ " & "ORDER BY Pickupyd"
Me.cboPickupYd.RowSource = lSql

mSql = "SELECT Distinct Delivyd,Clientid " & "FROM tbltanksrate " & "WHERE
ClientId = """ & Me.cboClientId & """ " & "ORDER BY Delivyd"
Me.cboDelivYd.RowSource = mSql

End Sub

Thanks,
Barb
 

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