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!

strSQL Where statement

Status
Not open for further replies.

lizzbizz

MIS
Dec 17, 2001
6
US
Why won't this VB code work? I only want Jobs where the Job is not empty or not equal to an asterisk *. It crashes where I try to insert the second part of the Where statement.

strSQL = "Select Job, Category, Sum(Area) as SumOfArea, ([SumOfArea])*[Forms]![Form1]![Cost] as Price "
strSQL = strSQL & "FROM " & Forms!Form1!MonthYear
strSQL = strSQL & " Where Job is Not Null "
strSQL = strSQL & &quot;And Job <> &quot; * &quot; &quot;
strSQL = strSQL & &quot;Group By Job, Category;&quot;

Thanks.
 
The asterisk is a wildcard. It basically means &quot;anything or nothing&quot;.

For example, if you were setting criteria to look for customer phone numbers with the 708 telephone area code, you could use 708* to return those values.

If you're using it as a value in a table, I'd highly recommend changing it to something else.



HTH John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top