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

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

Post by Dirk Versave » Mon, 30 Nov 1998 04:00:00



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

 
 
 

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

Post by Harold Walmsle » Mon, 30 Nov 1998 04:00:00


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


 
 
 

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

Post by Paul Shapir » Mon, 30 Nov 1998 04:00:00


Access requires the # as the delimiter around literal date values.
So, strSQL = "SELECT * FROM orderTable Where datum=#" & workDate & "#"
--
Paul Shapiro


>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.

 
 
 

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

I 'm having a basic problem while writing  a vb-database application:
I want to select records from a table that match a certain date.
I tried to do this with the following code:

dim workdat as date

workdat = DateValue(Text1.Text)
Set rs = db.OpenRecordset("select * from " & ordertable & " where datum like " & workdat)

this returns always an empty recordset.

- I formatted the date variable  with / and - separators
- I changed french notation dd-mm-yy to mm-dd-yy
- datum is a dbdate field in my access table (DAO 3.5)

.......but nothing seems to help.

Where is the genius that  can solve my problem?

Thanks in advance,

Dirk Versavel
Belgium  

2. Ms Access

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

4. Syntax error converting datetime from character string.

5. ADO Accessing date fields in Text file - returns NULL instead of date

6. Script to recreate indexes?

7. Comparing datetime field (containing date, time values) to a date only string

8. Which version of Oracle for NCR SVR4 on a 3550 class machine?

9. Filtering out records with empty date field

10. NON EMPTY returns all rows when calculated member always returns a value

11. deleting date-field in vb6 with ms access

12. VB6 and Access 97 dB - Date fields

13. SQL: Select some data with date criteria, but only by Date part of date field