|
 |
access_asp thread: Query By Date Range
Message #1 by "Paul Price" <pprice@o...> on Mon, 25 Nov 2002 21:57:38
|
|
I think I'm overlooking something obvious but I get a data type mismatch
when I try to run the following code. Essentially what I want to do is to
query by account number then by a date range. The data type for the Date
field is Date/Time in Access. I would appreciate any help.
Paul
<%
Dim RowID
Dim WorkId
TheID = Request("RowID")
WorkId = Request("WorkID")
AcctNo = Request("AcctNo")
FromDate = Request("FromDate")
ToDate = Request("ToDate")
Dim TheSort
TheSort = Request("Sort")
if len(TheSort) = 0 then
TheSort = 1
end if
Set OMS = Server.CreateObject("ADODB.Connection")
OMS.ConnectionTimeout = 15
OMS.CommandTimeout = 30
OMS.Open "DSN=OMS;DriverId=25;FIL=MS
Access;MaxBufferSize=512;PageTimeout=5;", "",""
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set rsSet = Server.CreateObject("ADODB.Recordset")
CmdString = "SELECT * FROM ComPercentQry WHERE AcctNo= '" & AcctNo & "'
AND MailDate >= '" & FromDate & "' And MailDate <= '" & ToDate & "'"
if TheSort = 2 then
CmdString = CmdString & " order by MailDate"
elseif TheSort = 3 then
CmdString = CmdString & " order by Done"
elseif TheSort = 4 then
CmdString = CmdString & " order by Expr1"
Else
CmdString = CmdString & " order by WorkID"
end if
cmdTemp.CommandText = CmdString
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = OMS
rsSet.Open cmdTemp, , 0, 1
%>
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 26 Nov 2002 11:01:52 +1100
|
|
http://www.adopenstatic.com/faq/80040e07.asp
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul Price" <pprice@o...>
Subject: [access_asp] Query By Date Range
: I think I'm overlooking something obvious but I get a data type mismatch
: when I try to run the following code. Essentially what I want to do is to
: query by account number then by a date range. The data type for the Date
: field is Date/Time in Access. I would appreciate any help.
:
: Paul
:
: <%
: Dim RowID
: Dim WorkId
:
: TheID = Request("RowID")
: WorkId = Request("WorkID")
: AcctNo = Request("AcctNo")
: FromDate = Request("FromDate")
: ToDate = Request("ToDate")
: Dim TheSort
:
: TheSort = Request("Sort")
:
: if len(TheSort) = 0 then
: TheSort = 1
: end if
:
: Set OMS = Server.CreateObject("ADODB.Connection")
: OMS.ConnectionTimeout = 15
: OMS.CommandTimeout = 30
: OMS.Open "DSN=OMS;DriverId=25;FIL=MS
: Access;MaxBufferSize=512;PageTimeout=5;", "",""
: Set cmdTemp = Server.CreateObject("ADODB.Command")
: Set rsSet = Server.CreateObject("ADODB.Recordset")
: CmdString = "SELECT * FROM ComPercentQry WHERE AcctNo= '" & AcctNo & "'
: AND MailDate >= '" & FromDate & "' And MailDate <= '" & ToDate & "'"
:
: if TheSort = 2 then
: CmdString = CmdString & " order by MailDate"
: elseif TheSort = 3 then
: CmdString = CmdString & " order by Done"
: elseif TheSort = 4 then
: CmdString = CmdString & " order by Expr1"
: Else
: CmdString = CmdString & " order by WorkID"
: end if
:
: cmdTemp.CommandText = CmdString
: cmdTemp.CommandType = 1
: Set cmdTemp.ActiveConnection = OMS
: rsSet.Open cmdTemp, , 0, 1
: %>
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Paul Price" <pprice@o...> on Tue, 26 Nov 2002 20:47:12
|
|
Got it!! Thanks
Paul
> http://www.adopenstatic.com/faq/80040e07.asp
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Paul Price" <pprice@o...>
Subject: [access_asp] Query By Date Range
: I think I'm overlooking something obvious but I get a data type mismatch
: when I try to run the following code. Essentially what I want to do is to
: query by account number then by a date range. The data type for the Date
: field is Date/Time in Access. I would appreciate any help.
:
: Paul
:
: <%
: Dim RowID
: Dim WorkId
:
: TheID = Request("RowID")
: WorkId = Request("WorkID")
: AcctNo = Request("AcctNo")
: FromDate = Request("FromDate")
: ToDate = Request("ToDate")
: Dim TheSort
:
: TheSort = Request("Sort")
:
: if len(TheSort) = 0 then
: TheSort = 1
: end if
:
: Set OMS = Server.CreateObject("ADODB.Connection")
: OMS.ConnectionTimeout = 15
: OMS.CommandTimeout = 30
: OMS.Open "DSN=OMS;DriverId=25;FIL=MS
: Access;MaxBufferSize=512;PageTimeout=5;", "",""
: Set cmdTemp = Server.CreateObject("ADODB.Command")
: Set rsSet = Server.CreateObject("ADODB.Recordset")
: CmdString = "SELECT * FROM ComPercentQry WHERE AcctNo= '" & AcctNo & "'
: AND MailDate >= '" & FromDate & "' And MailDate <= '" & ToDate & "'"
:
: if TheSort = 2 then
: CmdString = CmdString & " order by MailDate"
: elseif TheSort = 3 then
: CmdString = CmdString & " order by Done"
: elseif TheSort = 4 then
: CmdString = CmdString & " order by Expr1"
: Else
: CmdString = CmdString & " order by WorkID"
: end if
:
: cmdTemp.CommandText = CmdString
: cmdTemp.CommandType = 1
: Set cmdTemp.ActiveConnection = OMS
: rsSet.Open cmdTemp, , 0, 1
: %>
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |