stillwillyboy
Technical User
I have a table Tbl_SalesNameAndNumber with the fields SalesNumber and SalesName. Info is as follows:
SalesNumber SalesName
1 Joe
2 Bob
9 House
On my form Frm_SalesName, I have a Combobox named cbo_SalesNumber. It works by showing me the different #’s to select: 1,2 or 9. It’s RowSourceType is Table/Query and its RowSource is Tbl_SalesNumberAndName. So far, so good.
I have text box (not combo) to display the SalesName, Selecting 1 in cbo_SalesNumber, should give me Joe in the text box, 2 for Bob, 9 for House. Seems like pretty standard stuff, but all I get in my text box is the number I selected in the combobox. I need the name to appear. I have tried SQL in the text box property, but lost what I typed somewhere along the line. I tried the following in the AfterUpdate for the text box.
Private Sub SalesNumber_AfterUpdate()
SalesName = DLookup("SalesName", "Tbl_SalesNumberAndName", _
"SalesNumber" & Me.SalesNumber)
End Sub
If someone could please tell me what I use and where I put it to get the SalesName to appear in the text box, I would be greatly appreciative.
TIA
Bill
SalesNumber SalesName
1 Joe
2 Bob
9 House
On my form Frm_SalesName, I have a Combobox named cbo_SalesNumber. It works by showing me the different #’s to select: 1,2 or 9. It’s RowSourceType is Table/Query and its RowSource is Tbl_SalesNumberAndName. So far, so good.
I have text box (not combo) to display the SalesName, Selecting 1 in cbo_SalesNumber, should give me Joe in the text box, 2 for Bob, 9 for House. Seems like pretty standard stuff, but all I get in my text box is the number I selected in the combobox. I need the name to appear. I have tried SQL in the text box property, but lost what I typed somewhere along the line. I tried the following in the AfterUpdate for the text box.
Private Sub SalesNumber_AfterUpdate()
SalesName = DLookup("SalesName", "Tbl_SalesNumberAndName", _
"SalesNumber" & Me.SalesNumber)
End Sub
If someone could please tell me what I use and where I put it to get the SalesName to appear in the text box, I would be greatly appreciative.
TIA
Bill