Hi all,
I'm having a very strange issue with populating a combobox in access. It's a fairly straight forward scenario. I have a form with a number of fields on it. When I select a value from a combobox I want it to update a number of other fields, specifically 2 other combobox's and a text box.
It should be straightforward but no value appears in the 2nd combobox despite the fact that a quick MsgBox to test it's value displays the value I would expect to see. So while the MsgBox says there is a value nothing actually appears.
Any ideas (and no the text colour isn't white or anything like that)???
The code is as follows:
I'm having a very strange issue with populating a combobox in access. It's a fairly straight forward scenario. I have a form with a number of fields on it. When I select a value from a combobox I want it to update a number of other fields, specifically 2 other combobox's and a text box.
It should be straightforward but no value appears in the 2nd combobox despite the fact that a quick MsgBox to test it's value displays the value I would expect to see. So while the MsgBox says there is a value nothing actually appears.
Any ideas (and no the text colour isn't white or anything like that)???
The code is as follows:
Private Sub ComboBox1_AfterUpdate()
' This code will search the records on the form that
' match the value in Combobox1.
' This in turn updates Textbox1 with the corresponding
' value from the table.
Me.Combobox2.SetFocus
DoCmd.FindRecord Me.Combobox1
' This will set the value in Combobox2 equal to the
' value in Textbox1 and moves the focus to Combobox 2
Me.Combobox2 = Me.Textbox1
Me.Combobx2.SetFocus
' This MsgBox is a test of the value in Combobox2
MsgBox "Value in Combobox2 = " & Me.Combobox2
End Sub' match the value in Combobox1.
' This in turn updates Textbox1 with the corresponding
' value from the table.
Me.Combobox2.SetFocus
DoCmd.FindRecord Me.Combobox1
' This will set the value in Combobox2 equal to the
' value in Textbox1 and moves the focus to Combobox 2
Me.Combobox2 = Me.Textbox1
Me.Combobx2.SetFocus
' This MsgBox is a test of the value in Combobox2
MsgBox "Value in Combobox2 = " & Me.Combobox2