I have implemented successfully a single-cascade ComboBox combination on a form in my database (using an AfterUpdate event code). I have also successfully implemented a ComboBox + TextBox combination, whereby the TextBox shows contents of another column from the query for the ComboBox.
It's when I try to link these two up together when the problem comes up. I've been trying to find a solution to this coding problem in a practice unbound form.
ComboBox1 is called Field1, it drives...
ComboBox2, which is called Field2. This has 2 Columns, the second one hidden
TextBox1, which is called Field3
Here is the code I'm using:
Private Sub Field1_AfterUpd ate()
Me.Field2.RowSo urce = "SELECT Field_2 FROM" & _
" tbl_test WHERE Field_1 = '" & Me.Field1.Text & _
"' ORDER BY Field_2"
Me.Field2.Value = ""
Me.Field1.Reque ry
End Sub
When I first switch from Design to Form view, the TextBox and ComboBox2 properly display their contents. However, as soon as I actually use ComboBox1, the ComboBox2 filtering works, but the second column (containing what should be displayed in the TextBox goes blank, and so does the TextBox
Any suggestions for fixing the code?
It's when I try to link these two up together when the problem comes up. I've been trying to find a solution to this coding problem in a practice unbound form.
ComboBox1 is called Field1, it drives...
ComboBox2, which is called Field2. This has 2 Columns, the second one hidden
TextBox1, which is called Field3
Here is the code I'm using:
Private Sub Field1_AfterUpd ate()
Me.Field2.RowSo urce = "SELECT Field_2 FROM" & _
" tbl_test WHERE Field_1 = '" & Me.Field1.Text & _
"' ORDER BY Field_2"
Me.Field2.Value = ""
Me.Field1.Reque ry
End Sub
When I first switch from Design to Form view, the TextBox and ComboBox2 properly display their contents. However, as soon as I actually use ComboBox1, the ComboBox2 filtering works, but the second column (containing what should be displayed in the TextBox goes blank, and so does the TextBox
Any suggestions for fixing the code?
Comment