473,698 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft VBScript compilation error '800a0401' in ASP

115 New Member
While running the program, i'm getting this error

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/admin/currentmonth.as p, line 26

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd("m",-1,Date()) Order By RFCInfo.Date"
---------------^

i need to display last one months records,3 months records, 6 month records and 1 yrs records seperatly. now i'm tring to display 1 month records. but while running this codes, in this sql statement under the "m" (Between Date() And DateAdd("m",-1,Date()) ) error occurs.

and i'm using ASP with Ms Access as database.

anyone have any idea why this error occurs. is this the way we can display the last 1 month records... like wise if we change the -1 to -3,-6 and all the last 3 months, last 6 months will be found out right.

Thanks in advance.
Apr 23 '07 #1
11 18649
Arnold Schuur
36 New Member
Caused by the quotes (") in the datepart function. If you want to use quotes within a string you will have to use double quotes ("")

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo) ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd(""m"",-1,Date()) Order By  RFCInfo.Date"
Apr 23 '07 #2
remya1000
115 New Member
I just tried giving ""m"" and run the program.

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd(""m"",-1,Date()) Order By RFCInfo.Date"

and the error occured is

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/admin/last3months.asp , line 132
and line 132 is... Set objRS = objConn.Execute (strSQL)
----------------------------------------------------------------------------------------------------------
Set objRS = objConn.Execute (strSQL)

If not objRS.EOF then
objRS.MoveFirst
currentinvno=ob jRS(3)
currentrfcno=ob jRs(2)
Do While Not objRS.EOF

<tr>
Display everything inside table
</tr>



<%
objRS.MoveNext
Loop
%>
<% end if %>

----------------------------------------------------------------------------------------------------------------


and i tried this code too.

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between DateAdd('d',-Day(Date())+1,D ate()) And DateAdd('m',1,D ateAdd('d',-Day(Date())-1,Date())) Order By RFCInfo.Date"


error occurs is

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/admin/currentmonth.as p, line 132

If anyone have any idea what's the problem, just help me. any other way to display current month,last 3 months,6 months,1 yrs records.

Thanks in advance
Apr 23 '07 #3
jhardman
3,406 Recognized Expert Specialist

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd("m",-1,Date()) Order By RFCInfo.Date"
---------------^
The two functions date() and dateAdd() need to be outside the quotes used to make the query string. Try:
Expand|Select|Wrap|Line Numbers
  1. ..." AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between " & Date() & " And " & DateAdd("m",-1,Date()) & " Order By  RFCInfo.Date"
Let me know if this helps.

Jared
Apr 23 '07 #4
remya1000
115 New Member
I just tried this codes now.

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between " & Date() & " And " & DateAdd("m",-1,Date()) & " Order By RFCInfo.Date"

Now no error is there, but no records were displaying eventhough records were there in current months in database. The dealer who have current months records were not getting displayed. always the table is blank.

if you have anyidea how to do this or what the error, please help me.

thanks in advance
Apr 24 '07 #5
Arnold Schuur
36 New Member
Try to put a single quote (') around each columnname that is of type 'datetime':

Date Between '" & Date() & "' And '" & DateAdd("m",-1,Date()) & "' Order By RFCInfo.Date"
Apr 24 '07 #6
remya1000
115 New Member
I just tried that now.

strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between '" & Date() & "' And '" & DateAdd("m",-1,Date()) & "' Order By RFCInfo.Date"

And the error occured is

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/admin/currentmonth.as p, line 132

and line 132 is Set objRS = objConn.Execute (strSQL)

If you have anyidea how to do this or what's the error please let me know...

Thanks in advance
Apr 24 '07 #7
jhardman
3,406 Recognized Expert Specialist
The problem is that the date could be stored in several formats. I was going to suggest the single quotes too, like Arnold, but I didn't have a lot of hope for it. for the purposes of trouble shooting, add this line immediately after:
Expand|Select|Wrap|Line Numbers
  1. response.write vbNewLine & strSQL & "<br>" & vbNewLine
compare the output to the date in your db. Are they in the same format?

Jared
Apr 24 '07 #8
remya1000
115 New Member
i tried this and now its comming like

SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted , InvoiceDetail.Q uantity, InvoiceDetail.D escription, InvoiceDetail.E xtendedPrice, InvoiceInfo.GST , InvoiceInfo.PST , InvoiceInfo.Tot al FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.I nvNo = InvoiceInfo.Inv No) ON RFCInfo.InvNo = InvoiceInfo.Inv No where RFCInfo.DealerI D =17 AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between '4/24/2007' And '3/24/2007' Order By RFCInfo.Date

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

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/admin/currentmonth.as p, line 134

and in database the date is saved as 3/24/2007 12:16:21 PM format

so how can i check the date here. in sql only the date is comparing. so please help me if you have any idea.

and thanks for your help....

and thanks in advance
Apr 24 '07 #9
jhardman
3,406 Recognized Expert Specialist
OK, take out the single quotes, and change "date()" both times you use it to "now()". Tell me what comes up.

Jared
Apr 24 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8145
by: Matthew Louden | last post by:
I have no idea what's wrong with the following ASP statement: Response.Write "<select name=\"id\">" MS VBScript Compilation error 800a0401 expected end of statement However, if I do the following, it will be fine: <select name="id">
3
17113
by: Matt | last post by:
When the ASP statement end with a _ character, then the next line cannot have comment ' character. Is that correct? Since I encountered the following error: Microsoft VBScript compilation (0x800A0400) Expected statement sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _ ' & 2 & "," _ & beginhour & "," _
3
4669
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able to find out is that Microsoft has had the same problem on their site!
6
3802
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able to find out is that Microsoft has had the same problem on their site!
5
2848
by: char | last post by:
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400' SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET") MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)" MyRecordSet.OPEN MySQL, XXXXXX if not MyRecordSet.eof then MyArray = MyRecordSet.GETROWS() MyRecordSet.CLOSE FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
8
3758
by: Charmie1701 | last post by:
Can anyone help...? I keep getting this error message and am now getting angry. I have checked my syntax hundreds of times and can not seem to find anything wrong with it....I think I need a fresh pair of eyes..please can someone help me. I have copied the code below: =================================================== Expected end of statement /admin/news_update_pro.asp, line 22
3
6238
by: Indy | last post by:
Hi, I am new to VB and have some previous programming experiences. Curently working as an IT support person and trying to write a VB 6 script to access apos database and get one of the table's field value. I think this is not that hard for a experience VB programmer, but I am kind a stuggling. Can any one have a similler code for this task? When I am compling my code I am getting an error in the first line.
2
4993
by: kevinr | last post by:
Hi, I am brand new to VB, and I am trying to deploy Office 2007 on my network here at work. We used part of this script to do another deployment, and I have taken pieces and tried to edit for this deployment. I know I am probably way off the mark, but I would appreciate any help. This is the initial error I receive when running the script. C:\bkuptestpc\kr_migrate.vbs(276, 1) Microsoft VBScript compilation error: Expected 'End' Exit code: 1 ,...
2
3001
by: sarahj | last post by:
Microsoft VBScript compilation error '800a0401' Expected end of statement /forms/lgctest.asp, line 17 Dim name,municipal position,municipality,address,city,state,zip,email here's my code
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.