My form has a combo box 'Programs' in the header. When a program is selected the form displays all the data for that program. Works great with text boxes.
One text box displays the location of the program. Programs can move to other locations, so I would like to have the locations box be a combo box where I can select a different location and write that to the database.
Programs and Locations are 2 different tables.
When I select a program, the combo box drops down and shows all locations - great (row source is from the locations table). But, I would like it to show the location where the program currently resides.
Here is my code:
Private Sub cmbSelectProgram_AfterUpdate()
Me.Requery
Me!cmbLocName.SetFocus
Me!cmbLocName.Value = Me!LocName
MsgBox Me!cmbLocName.Value
End Sub
I can tell from the msgbox that cbmlocname.value is being set to what I expect it to. However the combo box is not displaying a value. Plus, when drop it down the order is all messed up.
Can anyone point out what I'm missing?
Thank you.
One text box displays the location of the program. Programs can move to other locations, so I would like to have the locations box be a combo box where I can select a different location and write that to the database.
Programs and Locations are 2 different tables.
When I select a program, the combo box drops down and shows all locations - great (row source is from the locations table). But, I would like it to show the location where the program currently resides.
Here is my code:
Private Sub cmbSelectProgram_AfterUpdate()
Me.Requery
Me!cmbLocName.SetFocus
Me!cmbLocName.Value = Me!LocName
MsgBox Me!cmbLocName.Value
End Sub
I can tell from the msgbox that cbmlocname.value is being set to what I expect it to. However the combo box is not displaying a value. Plus, when drop it down the order is all messed up.
Can anyone point out what I'm missing?
Thank you.