This is a multi-part message in MIME format.
------=_NextPart_000_005D_01C4B74E.88CF5E00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Good Morning,
Got some good advice yesterday, but still running into issues. I am =
trying to query an Access db once a user selects a month/yr from a =
dropdown list. =20
Below is summary of my code:
=20
Dim CurrentStrMth as String=20
Dim CurrentEndMth as String
if drpdate.selecteditem.text =3D "JANUARY 04" then=20
CurrentStrMth =3D "#1/1/2004#"=20
CurrentEndMth =3D "#1/31/2004#" =20
When I run the query below without passing any variables it works fine:
cmdSelect1 =3D New OleDbCommand("SELECT Count(*) from db WHERE [Submit =
Date/Time]>=3D#1/1/2004# and [Submit =
Date/Time]<=3D#1/31/2004#",dbconnection)
However, when I try to incorporate the string variables, as noted below, =
into the query I get "Character constant must contain exactly one =
character". I can't find anything on this on the web!=20
cmdSelect1 =3D New OleDbCommand("Select Count(*) from db where [submit =
date/time] >=3D '"CurrentStrMth"' and [submit date/time] <=3D =
'"CurrentEndMth"'", dbconnection)
If someone could assist me further with this issue, it would be greatly =
appreciated?
Thanks in advance!
MKC
------=_NextPart_000_005D_01C4B74E.88CF5E00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Good Morning,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Got some good advice yesterday, but =
still running=20
into issues. I am trying to query an Access db once a user selects =
a=20
month/yr from a dropdown list. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Below is summary of my =
code:</FONT></DIV>
<DIV> </DIV>
<DIV>Dim CurrentStrMth as String </DIV>
<DIV>Dim CurrentEndMth as String</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>if drpdate.selecteditem.text =3D "JANUARY 04" then </DIV>
<DIV>CurrentStrMth =3D "#1/1/2004#" </DIV>
<DIV>CurrentEndMth =3D "#1/31/2004#" </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>When I run the query below without =
passing any=20
variables it works fine:</FONT></DIV>
<DIV>
<DIV>cmdSelect1 =3D New OleDbCommand("SELECT Count(*) from db WHERE =
[Submit=20
Date/Time]>=3D#1/1/2004# and [Submit=20
Date/Time]<=3D#1/31/2004#",dbconnection)</DIV></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>However, when I try to incorporate the =
string=20
variables, as noted below, into the query I get "Character constant must =
contain=20
exactly one character". I can't find anything on this on the=20
web! </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>cmdSelect1 =3D New OleDbCommand("Select Count(*) from db where =
[submit=20
date/time] >=3D '"CurrentStrMth"' and [submit date/time] <=3D=20
'"CurrentEndMth"'", dbconnection)</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2>If someone could assist me further =
with this=20
issue, it would be greatly appreciated?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>MKC</FONT></DIV></DIV></BODY></HTML>
------=_NextPart_000_005D_01C4B74E.88CF5E00--