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 >= #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>
<>name<br>
<br>
Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.