Cascading Combo Box Troubleshooting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello. I know that the answer is out there but I've spent almost two hours
looking for it without succes. So, I'm hoping someone here will be kind
enough to offer some advice.

I want the standard: pick something in combo box 1, combo box 2 fills in.

This is my code:

Private Sub DepartmentId_AfterUpdate()

Me.Director.RowSource = "SELECT [Director] FROM tblDepartments WHERE
[Department]= " & Me.DepartmentId & ""
Me.Director.Requery

End Sub

However, I get nothing in combo box 2.

What's wrong with this? Please help. Thx.
 
saguilar,

if department is a numeric datatype, then the following should work:

Me.Director.RowSource = "SELECT [Director] FROM tblDepartments " & _
"WHERE [Department]=" & Me.DepartmentId

if it's text, then you'll need addtional punctuation

Me.Director.RowSource = "SELECT [Director] FROM tblDepartments " & _
"WHERE [Department]='" & Me.DepartmentId & "'"

or

Me.Director.RowSource = "SELECT [Director] FROM tblDepartments " & _
"WHERE [Department]=""" & Me.DepartmentId & """"

Brian
 

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

Back
Top