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

Writing filters in SQL for an ADO Access Database using VB

Status
Not open for further replies.

EmanURL

Programmer
Sep 9, 2010
3
US
Applying a date filter and Field filter equal to the input on a form and a table filter where a field does not equal none, null or n/a and a table filter where a field equals a certain word
mysql = "INSERT INTO DPurateo ( D, Q, P ) " & _
"SELECT D, Sum(SumOfD) AS Q, " & _
"CDbl(0) AS P " & _
"FROM " & FPYield & " " & _
WHERE (((TblD.ReportDate) Between #" & txtStartD & "# And #" & txtEndD & "#) " & _
"AND ((TblD.Project)= '" & txtProject&"') AND ((TblD.Place Of Occurance)= "F" & "'))" & _
"AND ((TblD.D )<> "None", And <> "N/A" , And <>"Null")
"GROUP BY Defect, Q, P " & _
"ORDER BY Sum(SumOfD) DESC;"



Romans 8:28 All things work together for the good
 
Is that a question? If so what is the question?
 
You have to include the field name each time, you have to encapsulate with single quotes instead of double or you can use triple double or Chr(34) but in this case single quotes are probably best, and you can't compare something = Null as nothing is EQUAL to NULL.

Code:
"AND (TblD.D <> 'None' And TblD.D <> 'N/A' And TblD.D Is Not Null)

Bob Larson
Free Access Tutorials and Samples:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top