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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement

Status
Not open for further replies.

ITA

Programmer
Nov 9, 1999
18
0
0
US
I am trying to find the correct syntax to use in a SQL statement that will draw information from a table but omit certian records based on a field. I am hoping that someone will be able to help me with the correct sql statement.
 
VBA code<br>
Dim db as database, rst as recordset, SQL as string<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = "SELECT * FROM Orders WHERE OrderDate &gt;= #1-1-95#;"<br>
Set rst = db.OpenRecordset(SQL)<br>
debug.print rst.fields("Orderdate")<br>
-----<br>
OR <br>
in the queries TAB<br>
<br>
SELECT Distributors.CUSTNUM, Distributors.COMPANY, Distributors.ADDRESS, Distributors.ZIP<br>
FROM Distributors;<br>
<br>
<br>

 
I'm no sure I answered your question above.<br>
Give us some idea of where the data is coming from.<br>
tables, forms, calculations and I can create an example.<br>

 
I have used a logical operator to solve my problem. Basically I was using a table to list names, and I wanted to pull all the names for a particular report. I also wanted to leave out one name from the table. Below is what I used on the SQL statement:<br>
<br>
&lt;&gt;name<br>
<br>
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top