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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date is str - from ACCESS 2000

Status
Not open for further replies.

Dewey

Programmer
Jan 25, 2000
21
US
I have an ACCESS 2000 db, where I have 4000 recordsets with 13 fields, one field is the date entered, which DATA TYPE is set to Date/Time. In Access I can sort by this Date field, and use the BETWEEN parameters fine.<br>
<br>
When I use VB6 code and load a form in the MSGrid from this database, the Date field is loaded into the grid as a string or number(definitely not a date). I know this because in my VB6 code the SQL LIKE will select it. Also when I input a date to a variable , i.e 01/12/00, it get the message back 'divison by 0'. <br>
<br>
I have tried '',&quot;&quot;,(),[] around the variable, and set the variable to PUBLIC, and still don't work. The documentation is really scarce on this quirk. I have run out of ideas.. <br>
<br>
my SQL code is elementary:<br>
<br>
PUBLIC VarStartDate as Date<br>
PUBLIC VarEndDate as Date<br>
<br>
SELECT * FROM tblKillSheet BETWEEN varStartDate AND varEndDate <p>Dewey Davis<br><a href=mailto:ddavis@dfn.com>ddavis@dfn.com</a><br><a href= > </a><br>
 
i dont know about Access 2000, but i know with Access97, and working with ADO in VC++, that you could Dim Var as Varient, and it'll autochose, but i know when using ADO, you will either get it as a String or a number., but try Varient, see what happens <p>Karl<br><a href=mailto:kb244@bellsouth.net>kb244@bellsouth.net</a><br><a href= </a><br>
 
One more thing to try...<br>
Try using the Pound symbol in front of and behind the date<br>
<br>
... & &quot;#&quot; & Mydate & &quot;#&quot; ...<br>
<br>
so it will pass this<br>
<br>
#01/12/00#<br>
<br>
I have to use that sometimes in Access itself.<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top