vb6 date variables comparing with access date fields returns always empty recordset 
Author Message
 vb6 date variables comparing with access date fields returns always empty recordset

I want to select records from a table that equal a given date.
I tried the following:

dim workdate as date

workdate = datevalue(text1.text)
Set bestelrs = besteldb.OpenRecordset("select * from " & ordertable & "
where datum = " & workdate)

this returns always an empty recordset.

- I changed separators in date varaible from / to -
- I changed french date notation dd-mm-yy to mm-dd-yy
- datum is a dbdate field in the table

Who can help me on this?

Thanks in advance,

Dirk Versavel
Belgium



Thu, 17 May 2001 03:00:00 GMT  
 vb6 date variables comparing with access date fields returns always empty recordset
I think you need to enclose the date in #s
Like this #25/12/98#



Quote:
> I want to select records from a table that equal a given date.
> I tried the following:

> dim workdate as date

> workdate = datevalue(text1.text)
> Set bestelrs = besteldb.OpenRecordset("select * from " & ordertable & "
> where datum = " & workdate)

> this returns always an empty recordset.

> - I changed separators in date varaible from / to -
> - I changed french date notation dd-mm-yy to mm-dd-yy
> - datum is a dbdate field in the table

> Who can help me on this?

> Thanks in advance,

> Dirk Versavel
> Belgium



Thu, 17 May 2001 03:00:00 GMT  
 vb6 date variables comparing with access date fields returns always empty recordset
Access requires the # as the delimiter around literal date values.
So, strSQL = "SELECT * FROM orderTable Where datum=#" & workDate & "#"
--
Paul Shapiro

Quote:

>I want to select records from a table that equal a given date.
>I tried the following:

>dim workdate as date

>workdate = datevalue(text1.text)
>Set bestelrs = besteldb.OpenRecordset("select * from " & ordertable & "
>where datum = " & workdate)

>this returns always an empty recordset.



Thu, 17 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. comparing VB6 date variables with access date fields returns always 'not equal'

2. How do I store an empty date on a date field (MS Access)

3. Record Set Date Compare to Mem Var Date

4. Compare date in form with date/time in form with date/time in database

5. Comparing dates and Access fields

6. Crystal Reports 8.5 date range parameter field - record selection that includes null date range

7. Selecting Date Fields that fall between two dates in Access

8. Null date values in Date/Time fields in Access DB

9. How do you update a null date into an access table date field

10. ADO with Access Date/Time field not storing the time, just the date

11. Problem accessing record from SQL Data base Date/Time Field

12. deleting date-field in vb6 with ms access

 

 
Powered by phpBB® Forum Software