SQL FoxPro ODBC Table Query using Current Date 
Author Message
 SQL FoxPro ODBC Table Query using Current Date

I am using Data Environment in VB.  It is reading an ODBC Connection
to a FoxPro 2.6 table.  How do I query using the current system date?

For example

WHERE orddate <= [system date here]

... and can I set it back like this

WHERE orddate >= [system date here]-60
to start from 60 days back?

Thanks in advance

Tim



Sun, 22 Aug 2004 01:50:16 GMT  
 SQL FoxPro ODBC Table Query using Current Date
For all you fellow sufferers out there, here is the answer.  Remember,
this is for VB6, Da{*filter*}vironment SQL Designer window, FoxPro2.6 Table
through an ODBC connection using Microsoft dBase VFP Driver (*.dbf)
6.01.8629.01 which seems to be the same as Microsoft FoxPro VFP Driver
(*.dbf) with the same number.

DATETIME() gives you the Date and Time
TTOD(DATETIME()) gives you the Date only
(TTOD(DATETIME())  - 180)  subtracts 180 days from the Current Date
and gives you something to compare an Orderdate in the table with.

DATE() does not work
NOW() does not work
TODAY() does not work
etc etc.  Why?  Because it is using the VFP driver and will only
accept VFP functions that work with Data environment.

And alway remember:  You never know when you might want to know that.
But if you know it, you know you'll never need to know it.  So don't
forget it.

Quote:

> I am using Data Environment in VB.  It is reading an ODBC Connection
> to a FoxPro 2.6 table.  How do I query using the current system date?

> For example

> WHERE orddate <= [system date here]

> ... and can I set it back like this

> WHERE orddate >= [system date here]-60
> to start from 60 days back?

> Thanks in advance

> Tim



Mon, 23 Aug 2004 23:03:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. insert sql syntax for FOXPRO using ADO with DATE columns

2. ADO connection using Foxpro table (DBF) - SQL

3. VBA date query - not getting current date

4. Runtime error using Date() in SQL query

5. ODBC error when using SQL delete from dBase table

6. ODBC error when using SQL delete from dBase table

7. Exclusive table locking using ODBC and Access97 or SQL 6.5

8. Help:SQL Query using a Date/time variable

9. Using FoxPro 3.0 tables in VB using ADO

10. Packing a FoxPro table via ODBC.net from VB.net

11. Updating Visual FoxPro Table in VB4 through ODBC

12. VBS accessing foxpro db/tables via odbc

 

 
Powered by phpBB® Forum Software