How to I take the value of my textbox and send it to a query?
Printable View
How to I take the value of my textbox and send it to a query?
Code:Dim sTextboxValue As String
Dim sSQL as string
sTextboxValue = TextBox1.Text
sSQL = "SELECT * FROM [yourtable] WHERE [yourField] = ' " & sTextboxValue & " ';"
You can gain access to any control on your form by using the Forms collection.
VB Code:
Forms![Form1]![txtTextBox1].Value ,etc.