how can I process a select query using a list box value as a where variable

wjulaxer13

New member
Local time
Today, 18:06
Joined
Apr 22, 2015
Messages
9
I am using Access 2013. I have the ability to pull a selection from a listbox. I can create a Select Sql string using that variable

sql As String, strCompany As String, strWhere As String
strCompany = strCompany & Me.lstResource.Column(0, varItem)
strWhere = "[Company name]=" & "'" & strCompany & "'"
sql = "select * FROM tblResources WHERE " & strWhere

From here I have trouble. I see lots of examples to run an active query but not much on a select query. I have tried a number of things with no success. Can someone give me an idea on how to use this select statement to actually run against an existing access table? I am not putting it into a form or report at this time, just running the query to check results. Thank you
 

Users who are viewing this thread

Back
Top Bottom