Need help with Select statement syntax to retrieve Access2000 record between two dates 
Author Message
 Need help with Select statement syntax to retrieve Access2000 record between two dates

Hi all,

I'm using ADO 2.6, VB6 and Access2000.

I needed to retrieve record from the Access2000 table between two dates.

Can anyone help me with the proper Select statement syntax.

I use the following statement and not able to get it to work.

    "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN '" & dt_date1 & '" AND
'" & dt_date2 & "'"

Thanks in advance!



Sun, 31 Jul 2005 08:13:04 GMT  
 Need help with Select statement syntax to retrieve Access2000 record between two dates
Samuel

Enclose the date value in # sign and try

 "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN #" & dt_date1 & "# AND #"
& dt_date2 & "#"

Sukesh


Quote:
> Hi all,

> I'm using ADO 2.6, VB6 and Access2000.

> I needed to retrieve record from the Access2000 table between two dates.

> Can anyone help me with the proper Select statement syntax.

> I use the following statement and not able to get it to work.

>     "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN '" & dt_date1 & '"
AND
> '" & dt_date2 & "'"

> Thanks in advance!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003


Sun, 31 Jul 2005 09:59:32 GMT  
 Need help with Select statement syntax to retrieve Access2000 record between two dates

Quote:

> Hi all,

> I'm using ADO 2.6, VB6 and Access2000.

> I needed to retrieve record from the Access2000 table between two
> dates.

> Can anyone help me with the proper Select statement syntax.

> I use the following statement and not able to get it to work.

>     "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN '" & dt_date1 &
> '" AND '" & dt_date2 & "'"

Why doesn't it work?
Does it fail to compile?
Does it return an error?
If so, what is the error?
Have you run the resultant SQL statement in SQL Worksheet?
If so, is the result from there correct?
etc...

--
Regards,

Michael Cole



Sun, 31 Jul 2005 10:59:27 GMT  
 Need help with Select statement syntax to retrieve Access2000 record between two dates
Sukesh,

Thanks for your help.

It's working now using your advice.

Sam


Quote:
> Samuel

> Enclose the date value in # sign and try

>  "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN #" & dt_date1 & "# AND
#"
> & dt_date2 & "#"

> Sukesh



> > Hi all,

> > I'm using ADO 2.6, VB6 and Access2000.

> > I needed to retrieve record from the Access2000 table between two dates.

> > Can anyone help me with the proper Select statement syntax.

> > I use the following statement and not able to get it to work.

> >     "SELECT * FROM tbl_Invoice WHERE InvDate BETWEEN '" & dt_date1 & '"
> AND
> > '" & dt_date2 & "'"

> > Thanks in advance!

> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003



Tue, 02 Aug 2005 17:00:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need help with Select statement syntax to retrieve Access2000 record between two dates

2. IF then statement with two control arrays, need syntax help

3. syntax of SQL statement needs help

4. Need help with syntax of INSERT INTO statement

5. How to select the current record only with SELECT statement

6. select record 1 to n on access2000

7. SELECT Statement Syntax

8. Need help with Select, Where, Or statement

9. Need Help in Retrieving a Specific Record

10. Need help counting number of records retrieved from an Access file

11. Need help retrieving records that are dated closest to today VB4

12. How to retrieve 2 select statements from one Stored Procedure

 

 
Powered by phpBB® Forum Software