DreadPirate
Technical User
Hi all. Sorry, another newbie here with a question that is sure to make you laugh. I apologize in advance for my simple mind.
Here's the issue; I have a table in Access. I'm trying to use a VB program to query that table and bring up info from several fields. The user types in a CityID (the key field in the table) and a few other fields pop up in a new form. Simple, I'm sure, but infuriating. How do you pass the variable from the User input to the data call? Here's the code I've been trying. I'm sure the reason it doesn't work is due to the ridiculous place I stuffed the variable "IDinput", but I don't know how else to do it. Please, Please help.
Private Sub cmdTest_Click()
Dim IDinput
IDinput = txtIDEnter.Text 'this is the user input box
Data1.Recordset.FindFirst "CityID = '(IDinput)'"
txtTest.Text = Data1.Recordset.Fields("Region".Value
End Sub
Here's the issue; I have a table in Access. I'm trying to use a VB program to query that table and bring up info from several fields. The user types in a CityID (the key field in the table) and a few other fields pop up in a new form. Simple, I'm sure, but infuriating. How do you pass the variable from the User input to the data call? Here's the code I've been trying. I'm sure the reason it doesn't work is due to the ridiculous place I stuffed the variable "IDinput", but I don't know how else to do it. Please, Please help.
Private Sub cmdTest_Click()
Dim IDinput
IDinput = txtIDEnter.Text 'this is the user input box
Data1.Recordset.FindFirst "CityID = '(IDinput)'"
txtTest.Text = Data1.Recordset.Fields("Region".Value
End Sub