Full Version: Problem with cascading combos.
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
timbreeding
Alright, I've got a nice cascading combo box going on except one thing.

I keep getting a type mismatch error.

Private Sub unit_AfterUpdate()

On Error Resume Next

Me.unit_num = Me.unit.Column(0)

cti_ewo_num.RowSource = "Select tbl_ewo_numbers.ewo_num " & _
"FROM tbl_ewo_numbers " & _
"WHERE tbl_ewo_numbers.project_num = '" & unit_num.Value & "' " & _
"ORDER BY tbl_ewo_numbers.id;"

End Sub

everything is fine except in the 'me.unit_num...' statement it's storing the numbers as text in the query that is built just below. I need a number stored in unit_num not a string. It tried solving the problem by switching tbl_ewo_numbers.project_num to a text field, but when I go to store a value in the combo box, there is another type mismatch to the field that the cti_ewo_num is bound to. Suggestions?
timbreeding
I even tried this and got the same results. It stores '3' in the query instead of just 3.

Private Sub unit_AfterUpdate()

Dim unit_des as Integer

On Error Resume Next

unit_des = Me.unit.Column(0)

cti_ewo_num.RowSource = "Select tbl_ewo_numbers.ewo_num " & _
"FROM tbl_ewo_numbers " & _
"WHERE tbl_ewo_numbers.project_num = '" & unit_des & "' " & _
"ORDER BY tbl_ewo_numbers.id;"

End Sub
timbreeding
I fixed it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.