I need to display current month,last 3months,6months and 1year records seperatly. and first i'm tring to display current month's records. and the error i received is this.
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/admin/currentmonth.asp, line 26
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"
---------------^
----------------------------------------------------------------------------------------------------------------
And someone gave me an advice that instead of this sql give this sql and i changed this sql to.
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"",-3,Date()) Order By RFCInfo.Date"
and the error occured is this
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 i tried this sql too
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 DateAdd('d',-Day(Date())+1,Date()) And DateAdd('m',1,DateAdd('d',-Day(Date())-1,Date())) Order By RFCInfo.Date"
and the error occured is this
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 the line 132 is Set objRS = objConn.Execute(strSQL)
<%
Set objRS = objConn.Execute(strSQL)
If not objRS.EOF then
objRS.MoveFirst
currentinvno=objRS(3)
currentrfcno=objRs(2)
Do While Not objRS.EOF
%>
<%
objRS.MoveNext
Loop
%>
<% end if %>
------------------------------------------------------------------------------------------------------------
and i'm using ASP and MS access as database. and except this condition [And RFCInfo.Date Between Date() And DateAdd("m",-1,Date()) ] ,the program works perfect.
so if anyone have anyidea how to display current months,3months,6months records seperatly.... and what's the mistake in this codes. if you have any idea please let me know about that.
thanks in advance