Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variables in Access SQL Queries 1

Status
Not open for further replies.

SAINTLOUIS

Programmer
Feb 25, 2000
1
US
I am hoping that someone can help me here. I am having problems writing an SQL statement in Access using the DoCmd.RunSQL. I want to do this....Return all records and fields from a table where US1 matches the value of what I am returning from a listbox. I know its returning all the right values from what I select in the Listbox, but I need to write a SQL query to accept that value. Please someone help me.....!!!!!!!!!!!!!!!!..
 
Write a query in your Access query grid. Use "Forms!FormName!ListBoxName" as the selection criteria (sub actual name of form & listbox). Run this and see if it works correctly. If so, change your View to "SQL" and cut and past that into your code. If you haven't done this before, look at the Help examples to see how to work with code that doesn't fit on a single line.
 
Elizabeth,<br>
<br>
I've read many of your responses and I have an observation. You don't have to tell people to go to the "Help" file for assistance. I'm sure most, if not all, went that route before posting here.
 
&lt;&lt;I'm sure most, if not all, went that route before posting here&gt;&gt;<br>
Brian, you'd be surprised.<br>
--Jim<br>

 
Brian, thanks for your feedback. I agree that <i>many</i> would have looked there. But Help is sometimes a difficult tool because it's not always organized as one would expect. I try to say &quot;look at help for this specific thing&quot; that they may have overlooked or not found. In this response, I'm anticipating SaintLouis may not be familiar with the line-continuation character and so may not have recognized it when s/he first saw the examples.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top