Ok so i imported an excel sheet into a table, which I will refer to as table1.
Inside a form, i which to populate a list box with the information from the table. I can get this to work by using the following code on a command button
***********
Dim ProdSelected As String
ProdSelected = "SELECT * FROM [table1] "
Me.resultlist.RowSource = ProdSelected
End Sub
********
What i want to do is use an unbound text box to allow the user to query for a particular field in this table. So this is WHAT I THINK is the code to use.
*******
Dim ProdSelected As String
ProdSelected = "SELECT * FROM [table1] "
If Len(Me.siteid & "") <> 0 Then
ProdSelected = ProdSelected & "WHERE [table1]![Req #] = '" & Me.siteid & "'"
End If
Me.resultlist.RowSource = ProdSelected
End Sub
***********
The name of the field being searched is Req #
Obviously what i am doing doesn't work. Any help would be appreciated
Inside a form, i which to populate a list box with the information from the table. I can get this to work by using the following code on a command button
***********
Dim ProdSelected As String
ProdSelected = "SELECT * FROM [table1] "
Me.resultlist.RowSource = ProdSelected
End Sub
********
What i want to do is use an unbound text box to allow the user to query for a particular field in this table. So this is WHAT I THINK is the code to use.
*******
Dim ProdSelected As String
ProdSelected = "SELECT * FROM [table1] "
If Len(Me.siteid & "") <> 0 Then
ProdSelected = ProdSelected & "WHERE [table1]![Req #] = '" & Me.siteid & "'"
End If
Me.resultlist.RowSource = ProdSelected
End Sub
***********
The name of the field being searched is Req #
Obviously what i am doing doesn't work. Any help would be appreciated