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!

problem with query, expected end of statement error?

Status
Not open for further replies.

bikebanditcom

Programmer
Jun 11, 2003
117
US
i get the following error from this page:


Microsoft VBScript compilation error '800a0401'

Expected end of statement

/pbc/reporting/TMPavoprmttwj.asp, line 13

rs = "SELECT tblSalesmen.salesmanName, tblSales.....

heres the query

SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate
FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID
WHERE (((tblSalesPackages.status)="Cancelled"));

the code:

rs = "SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesPackages.status)="Cancelled"));"

any idea anybody?
 
Use single quotes around 'Cancelled'

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
tried that?? doesnt work, what can i do?

here's my entire page:

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<%

salesman = request.form(&quot;salesman&quot;)

set pbcDB = server.createObject(&quot;ADODB.Connection&quot;)
pbcDB.open &quot;pbc&quot;

theSQL = &quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesPackages.status)=&quot;Cancelled&quot;))'&quot;

pbcDB.Execute(theSQL)



<% on error resume next %>

<html>
<head>
<title>Cancelled Report</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
<style type=&quot;text/css&quot;>
<!--
.style5 {font-size: 10pt}
-->
</style>
</head>

<body>
<h1><strong>Cancelled Sales Report </strong></h1>
<p><font size=&quot;2&quot;>Today is <%= Now %></font></p>
<p><font size=&quot;2&quot;>This is the cancelled sales report for <%= salesman %></font></p>
<form name=&quot;cancelReport&quot; method=&quot;post&quot; action=&quot;salesEdit.asp&quot;>
<table width=&quot;636&quot; border=&quot;1&quot; align=&quot;left&quot; cellpadding=&quot;4&quot; cellspacing=&quot;4&quot;>
<!--DWLayoutTable-->
<tr>
<td width=&quot;55&quot; height=&quot;30&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sales ID</font></td>
<td width=&quot;83&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sale Date</font></td>
<td width=&quot;121&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Project</font></td>
<td width=&quot;79&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Lot </font></td>
<td width=&quot;88&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Phase</font></td>
<td width=&quot;120&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Cancel Date</font></td>
</tr>
<tr>
<td height=&quot;28&quot; valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p><font size=&quot;2&quot;> </font><font size=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Save Excel Spreadsheet&quot;>
</font> </p>
</form>
<p><font size=&quot;2&quot;> </font> </p>
<p>&nbsp;</p>
<p><A href=&quot;default.asp&quot;><font size=&quot;2&quot;>Home</font></A><font size=&quot;2&quot;> | <A href=&quot;login.asp&quot;>Login</A>
| <A href=&quot;salesEntry.asp&quot;>Sales Entry</A> | <A href=&quot;salesEdit.asp&quot;>Sales Editing</A>
| <A href=&quot;scheduling.asp&quot;>Scheduling</A> | <A href=&quot;register.asp&quot;>Register
A New User</A> | <A href=&quot;dbControlPanel.asp&quot;>DB Control Panel</A> | Logout</font></p>
<p><font size=&quot;1&quot;>Copyright 2003 PBC Technologies Designed By <a href=&quot;mailto:%20dhayden@wecantlose.com&quot;>Dan
Hayden, Jr</a><br>
<a href=&quot; Can't Lose, LLC</a></font> </p>
<p>&nbsp;</p>
</body>
</html>
<%

pbcDB.close
set pbcDB = Nothing

%>
 
watch &quot;s and ()s. this also needs to all be on one line:
[tt] theSQL = &quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE tblSalesPackages.status ='Cancelled'&quot;[/tt]

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
I pasted you sql in an editor and you still didn't have it right, there was a stray single quote, and you didn't remove the double-quotes around Cancelled. This should work:
Code:
  theSQL = &quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesPackages.status)='Cancelled'))&quot;

Another reason it might not work is if something is misspelled - like maybe [tt]tblSales.estPaymen[/tt] instead of [tt]tblSales.estPayment[/tt]



VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
this is what i have, but i get page cannnot be displayed:
<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<%

salesman = request.form(&quot;salesman&quot;)

set pbcDB = server.createObject(&quot;ADODB.Connection&quot;)
pbcDB.open &quot;pbc&quot;

theSQL = &quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesPackages.status)='Cancelled'))&quot;


pbcDB.Execute(theSQL)

%>

<html>
<head>
<title>Cancelled Report</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
<style type=&quot;text/css&quot;>
<!--
.style5 {font-size: 10pt}
-->
</style>
</head>

<body>
<h1><strong>Cancelled Sales Report </strong></h1>
<p><font size=&quot;2&quot;>Today is <%= Now %></font></p>
<p><font size=&quot;2&quot;>This is the cancelled sales report for <%= salesman %></font></p>
<form name=&quot;cancelReport&quot; method=&quot;post&quot; action=&quot;salesEdit.asp&quot;>
<table width=&quot;636&quot; border=&quot;1&quot; align=&quot;left&quot; cellpadding=&quot;4&quot; cellspacing=&quot;4&quot;>
<!--DWLayoutTable-->
<tr>
<td width=&quot;55&quot; height=&quot;30&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sales ID</font></td>
<td width=&quot;83&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sale Date</font></td>
<td width=&quot;121&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Project</font></td>
<td width=&quot;79&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Lot </font></td>
<td width=&quot;88&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Phase</font></td>
<td width=&quot;120&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Cancel Date</font></td>
</tr>
<tr>
<td height=&quot;28&quot; valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p><font size=&quot;2&quot;> </font><font size=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Save Excel Spreadsheet&quot;>
</font> </p>
</form>
<p><font size=&quot;2&quot;> </font> </p>
<p>&nbsp;</p>
<p><A href=&quot;default.asp&quot;><font size=&quot;2&quot;>Home</font></A><font size=&quot;2&quot;> | <A href=&quot;login.asp&quot;>Login</A>
| <A href=&quot;salesEntry.asp&quot;>Sales Entry</A> | <A href=&quot;salesEdit.asp&quot;>Sales Editing</A>
| <A href=&quot;scheduling.asp&quot;>Scheduling</A> | <A href=&quot;register.asp&quot;>Register
A New User</A> | <A href=&quot;dbControlPanel.asp&quot;>DB Control Panel</A> | Logout</font></p>
<p><font size=&quot;1&quot;>Copyright 2003 PBC Technologies Designed By <a href=&quot;mailto:%20dhayden@wecantlose.com&quot;>Dan
Hayden, Jr</a><br>
<a href=&quot; Can't Lose, LLC</a></font> </p>
<p>&nbsp;</p>
</body>
</html>
<%

pbcDB.close
set pbcDB = Nothing

%>


whatta you think?
dan
 
Do you have 'Show friendly HTTP error messages' checked in IE Advanced options? If so, un-check it and try again to see if you get a more useful error message.

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
thanks for the advice, i was quickly able to determine the problem, fixed my dsn and now am not having these problems, but no my new problem is this:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/pbc/reporting/cancelledReport.asp, line 12

set cancelledSQL = pbcDB.Execute(&quot;SELECT tblSalesmen.salesmanName.....


i know the exact piece of code i've put in there that is doing this, the problem is i dont know how to call a variable properly in the sql statement. could you take a look at my statement and determine how i should write this? thanks

my page

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<%
salesman = request.Form(&quot;salesman&quot;)

Dim theSQL, pbcDB



set pbcDB = server.createObject(&quot;ADODB.Connection&quot;)
pbcDB.open &quot;pbc&quot;

set cancelledSQL = pbcDB.Execute(&quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesmen.salesmanName)='<%= salesman %>) AND (((tblSalesPackages.status)='Cancelled'))&quot;)

%>

<html>
<head>
<title>Cancelled Report</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
<style type=&quot;text/css&quot;>
<!--
.style5 {font-size: 10pt}
-->
</style>
</head>

<body>
<h1><strong>Cancelled Sales Report </strong></h1>
<p><font size=&quot;2&quot;>Today is <%= Now %></font></p>
<p><font size=&quot;2&quot;>This is the cancelled sales report for <%= salesman %></font></p>
<form name=&quot;cancelReport&quot; method=&quot;post&quot; action=&quot;salesEdit.asp&quot;>
<table width=&quot;636&quot; border=&quot;1&quot; align=&quot;left&quot; cellpadding=&quot;4&quot; cellspacing=&quot;4&quot;>
<!--DWLayoutTable-->
<tr>
<td width=&quot;55&quot; height=&quot;30&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sales ID</font></td>
<td width=&quot;83&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sale Date</font></td>
<td width=&quot;121&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Project</font></td>
<td width=&quot;79&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Lot </font></td>
<td width=&quot;88&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Phase</font></td>
<td width=&quot;120&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Cancel Date</font></td>
</tr>
<tr>
<td height=&quot;28&quot; valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><%= cancelledSQL(&quot;saleDate&quot;) %></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;></span></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p><font size=&quot;2&quot;> </font><font size=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Save Excel Spreadsheet&quot;>
</font> </p>
</form>
<p><font size=&quot;2&quot;> </font> </p>
<p>&nbsp;</p>
<p><A href=&quot;default.asp&quot;><font size=&quot;2&quot;>Home</font></A><font size=&quot;2&quot;> | <A href=&quot;login.asp&quot;>Login</A>
| <A href=&quot;salesEntry.asp&quot;>Sales Entry</A> | <A href=&quot;salesEdit.asp&quot;>Sales Editing</A>
| <A href=&quot;scheduling.asp&quot;>Scheduling</A> | <A href=&quot;register.asp&quot;>Register
A New User</A> | <A href=&quot;dbControlPanel.asp&quot;>DB Control Panel</A> | Logout</font></p>
<p><font size=&quot;1&quot;>Copyright 2003 PBC Technologies Designed By <a href=&quot;mailto:%20dhayden@wecantlose.com&quot;>Dan
Hayden, Jr</a><br>
<a href=&quot; Can't Lose, LLC</a></font> </p>
<p>&nbsp;</p>
</body>
</html>
<%

pbcDB.close
set pbcDB = Nothing

%>
 
you are already in an ASP code area so instead of using
<%= salesman %>

use
& salesman &

that should do it for you

-X
 
thanks for the advice, now i have one other problem that has surfaced since fixing that

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Missing ), ], or Item in query expression '(((tblSalesmen.salesmanName)= Hiram) AND (((tblSalesPackages.status)='Cancelled'))'.

/pbc/reporting/cancelledReport.asp, line 12

its feeding in a salesman name but then craps out here? what am i missing?




<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<%
salesman = request.Form(&quot;salesman&quot;)

Dim theSQL, pbcDB



set pbcDB = server.createObject(&quot;ADODB.Connection&quot;)
pbcDB.open &quot;pbc&quot;

set cancelledSQL = pbcDB.Execute(&quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesmen.salesmanName)= '& salesman &') AND (((tblSalesPackages.status)='Cancelled'))&quot;)


%>

<html>
<head>
<title>Cancelled Report</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
<style type=&quot;text/css&quot;>
<!--
.style5 {font-size: 10pt}
-->
</style>
</head>

<body>
<h1><strong>Cancelled Sales Report </strong></h1>
<p><font size=&quot;2&quot;>Today is <%= Now %></font></p>
<p><font size=&quot;2&quot;>This is the cancelled sales report for <%= salesman %></font></p>
<form name=&quot;cancelReport&quot; method=&quot;post&quot; action=&quot;salesEdit.asp&quot;>
<table width=&quot;502&quot; border=&quot;1&quot; align=&quot;left&quot; cellpadding=&quot;4&quot; cellspacing=&quot;4&quot;>
<!--DWLayoutTable-->
<tr>
<td width=&quot;75&quot; height=&quot;30&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Sale Date</font></td>
<td width=&quot;63&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Project</font></td>
<td width=&quot;121&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Lot</font></td>
<td width=&quot;79&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Phase</font></td>
<td width=&quot;88&quot; valign=&quot;top&quot;><font size=&quot;2&quot;>Cancel Date</font></td>
</tr>
<tr>
<td height=&quot;28&quot; valign=&quot;top&quot;><span class=&quot;style5&quot;><%= cancelledSQL(&quot;saleDate&quot;) %></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;><%= cancelledSQL(&quot;projectName&quot;) %></span></td>
<td valign=&quot;top&quot;></span><span class=&quot;style5&quot;><%= cancelledSQL(&quot;lotID&quot;) %></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;><%= cancelledSQL(&quot;phase&quot;) %></span></td>
<td valign=&quot;top&quot;><span class=&quot;style5&quot;><%= cancelledSQL(&quot;cancelDate&quot;) %></span></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p><font size=&quot;2&quot;> </font><font size=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Save Excel Spreadsheet&quot;>
</font> </p>
</form>
<p><font size=&quot;2&quot;> </font> </p>
<p>&nbsp;</p>
<p><A href=&quot;default.asp&quot;><font size=&quot;2&quot;>Home</font></A><font size=&quot;2&quot;> | <A href=&quot;login.asp&quot;>Login</A>
| <A href=&quot;salesEntry.asp&quot;>Sales Entry</A> | <A href=&quot;salesEdit.asp&quot;>Sales Editing</A>
| <A href=&quot;scheduling.asp&quot;>Scheduling</A> | <A href=&quot;register.asp&quot;>Register
A New User</A> | <A href=&quot;dbControlPanel.asp&quot;>DB Control Panel</A> | Logout</font></p>
<p><font size=&quot;1&quot;>Copyright 2003 PBC Technologies Designed By <a href=&quot;mailto:%20dhayden@wecantlose.com&quot;>Dan
Hayden, Jr</a><br>
<a href=&quot; Can't Lose, LLC</a></font> </p>
<p>&nbsp;</p>
</body>
</html>
<%

pbcDB.close
set pbcDB = Nothing

%>
 
Try this:
Code:
Set cancelledSQL = pbcDB.Execute(&quot;SELECT tblSalesmen.salesmanName, tblSales.saleDate, tblSales.slabDate, tblSales.estInstall, tblSales.estPaymen, tblSales.projectName, tblSales.phase, tblSales.lotID, tblSales.customer, tblSalesPackages.packageLevelId, tblSalesPackages.kbamnt, tblSalesPackages.pbcamnt, tblSalesPackages.status, tblSalesPackages.cancelDate FROM (tblSalesmen INNER JOIN tblSales ON tblSalesmen.salesmanID = tblSales.salesman) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSalesmen.salesmanName)= '&quot; & salesman & &quot;') AND (((tblSalesPackages.status)='Cancelled'))&quot;)

Your problem is that you didn't break the string to insert the variable, ie the variable shouldn't be contained inside the string:

Code:
  &quot;... )= '&quot; & salesman & &quot;') AND ...&quot;


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Missing ), ], or Item in query expression '(((tblSalesmen.salesmanName)= 'Hiram') AND (((tblSalesPackages.status)='Cancelled'))'.

/pbc/reporting/cancelledReport.asp, line 8
 
AND (((tblSalesPackages.status)=

Delete one of the ( after the AND

AND ((tblSalesPackages.status)=

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
that was it thanks so much, now im working on this statement and am getting

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/pbc/reporting/xlReports/TMPz49damvdu9.asp, line 8








set compReport = pbcDB.execute(&quot;SELECT tblLots.lotNum, tblSales.saleDate, tblSales.projectName, tblSales.phase, tblSales.kbAmnt, tblSales.PBCAmnt, tblSales.VOO, tblSales.billed, tblSalesPackages.status FROM (tblSales INNER JOIN tblLots ON tblSales.lotID = tblLots.lotNum) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE (((tblSales.billed) Is Null) AND ((tblSalesPackages.status)=&quot;Complete&quot;)))&quot;)

what is wrong here? i've counted all my parens and all are right, i think..:(
 
fixed it, i needed to remove the quotes around from complete, now i have this problem

same error msg

set noBillSQL = pbcDB.execute(&quot;SELECT tblLots.lotNum, tblSales.saleDate, tblSales.projectName, tblSales.phase, tblSales.kbAmnt, tblSales.PBCAmnt, tblSales.VOO, tblSales.billed, tblSalesPackages.status FROM (tblSales INNER JOIN tblLots ON tblSales.lotID = tblLots.lotNum) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE ((tblSales.saleDate) Between #&quot;date1&quot;# And #&quot;date2&quot;#) AND ((tblSales.billed) Is Null) AND ((tblSalesPackages.status)='Complete');&quot;)
 
Code:
set noBillSQL = pbcDB.execute(&quot;SELECT tblLots.lotNum, tblSales.saleDate, tblSales.projectName, tblSales.phase, tblSales.kbAmnt, tblSales.PBCAmnt, tblSales.VOO, tblSales.billed, tblSalesPackages.status FROM (tblSales INNER JOIN tblLots ON tblSales.lotID = tblLots.lotNum) INNER JOIN tblSalesPackages ON tblSales.saleID = tblSalesPackages.salesID WHERE ((tblSales.saleDate) Between #&quot; & date1 & &quot;# And #&quot; & date2 & &quot;#) AND ((tblSales.billed) Is Null) AND ((tblSalesPackages.status)='Complete');&quot;)


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top