Link to home
Start Free TrialLog in
Avatar of KerryG
KerryG

asked on

Dbase III Date Query Issue

I am having a devil of a time trying to get a particular query to work right.

I know what I want to accomplish "should" look like this using SQL:

SELECT debtor.firstname, debtor.lastname, debtor.tickle, debtor.actiondate, debtor.collcode
FROM debtor where status = 'WAH' and actiondate > '07/01/2004'

Since this is a DBase III file I am connecting to via ODBC, I am getting errors

The date format I am using seams to be wrong and I have tried numerous combinations of different formats.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Try:
SELECT debtor.firstname, debtor.lastname, debtor.tickle, debtor.actiondate, debtor.collcode
FROM debtor where status = 'WAH' and actiondate > '2004-07-01'
Also, please maintain these abandoned questions:
1 05/18/2004 500 Form field doesnt update dbase record  Open Visual Basic
2 05/19/2004 500 Printing from VB6 issues  Open Visual Basic
If I remember correctly, dBase III has a default date format of "mm/dd/yy".


SELECT debtor.firstname, debtor.lastname, debtor.tickle, debtor.actiondate, debtor.collcode
FROM debtor where status = 'WAH' and actiondate > '07/01/04'

You can change it to recognize a four digit year by using SET CENTURY ON in your dBase initialization.


Bob
Avatar of KerryG
KerryG

ASKER

I have tried both of those suggestions before even posting here. This is a DBase file that is normally used in an old DOS app hence I have no full DBase install to change any preference within. I need to access this from ODBC or some other means within VB6 and that is what I think is causing my date issue.
KerryG,
This is some old code I used to work with dBase and maybe using DAO will help, if you are not already.

Private Sub Command1_Click()
 Dim db As DAO.Database
 Dim path As String
 path = "C:\AAA testing\dbfwork\invoices.dbf"
    Dim DbfRs As DAO.Recordset
    Set db = OpenDatabase(path, False, False, "dBase IV")
    Set DbfRs = db.OpenRecordset("SELECT * From INVOICES Where INVOICES.PDDUEDATE > '01/01/89'")
End Sub

It seems to me you need to have the Borland Database Engine (DBE) installed to access the dbfs. That would be where you would set the dbase settings.

Hope this is helpful.
Avatar of KerryG

ASKER

I havent made ANY progress on this. Almost any query results in an "index not found" error.
Kerry,

The index is probably corrupted which is common in dbfs. Issuing the PACK  or  REINDEX command will usually repair corrupt indexes, but I believe you need the Borland Database Engine and/or dBase installed to do this.

Have you tried linking the dbfs to Access and accessing them through access? You could then export the tables to just about any format you want to work with them.

Check these also :   http://www.rayonline.com/jrinfo/
                            http://www.dbf-repair.com/
                            http://www.motobit.com/tips/detpg_asp-dbf-database.htm
                            http://www.e-bachmann.dk/docs/xbase.htm

If none of this helps, let us know how you are accessing files and what application you are using.

Bob
Avatar of KerryG

ASKER

Here is a more in-depth thread about my current problems:
https://www.experts-exchange.com/questions/21104228/Getting-index-not-found-querying-DBase-file.html

This is an old DOS program using dbase style tables and the indexes are .cdx files. I can link them into Access but still have the same issues. If I import the tables into Access then I can do what I want but that is not a clean solution as then I am not working with the live data. Although I am pretty close to just chucking the whole concept of using the live data and have a program dump from the dbase files into SQL server so I can get some performance out of it, but definitly not what I had intended to do.
ASKER CERTIFIED SOLUTION
Avatar of Bob Lamberson
Bob Lamberson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KerryG

ASKER

Thanks for the excellent tips and links!