PDA

Click to See Complete Forum and Search --> : FoxPro to VB


Tonatiuh
Jul 27th, 1999, 05:51 PM
I have a problem to open a FoxPro database in VB5 enterprise. I get two diferente error messages in this two ways to write the instruction.
Dim dbFox as Database
Set dbFox = OpenDatabase("d:\code\tablas\contra2", , , "FoxPro 3.0;")
I get the Run-Time error: 3024
can't find the file 'd:\code\tablas\contra2'

and in this other way
Dim dbFox as Database
Set dbFox = OpenDatabase("d:\code\tablas\contra2.dbf", , , "FoxPro 3.0;")
I get the Run-Time error: 3343
Can't recognize the database format
'd:\code\tablas\contra2.dbf'

I set te Data control properties as follows:

Data1.Connect="FoxPro 3.0;"
Data1.DatabaseName="d:\code\tablas"
Data1.DefaultType=2 'UseJet
Data1.RecordSource=Contra2

The path and filename are perfectly correct.
If I elimiate this conflictive line, and just link a TextBox to the first field of Data1 control, everything works OK and I can see data from the database. But, I need to define a recordset to update, apped, etc.

What's happening?

Any idea will be appreciated!

Ulises

[This message has been edited by Tonatiuh (edited 07-28-1999).]

uol98
Aug 3rd, 1999, 10:21 AM
You need to scratch off the contra2.dbf from the openrecordset and just have the path name. (Along with the last backslash - "c:\temp\") You then need to open a recordset with just the dbf file in parenthesis. openrecordset("contra2")

Hope it helps

hmcheung
Jun 4th, 2000, 10:54 AM
I'm a programmer in Hong Kong. I've to write programmes using VB to manipulate several foxpro 2.6 dbfs. It'd be very kind of you if you can give me some hints on my problem.

I'm using the following code and try to connect to "d:\andy\vb5\Hkdict.dbf"

Set dbMain = OpenDatabase("d:\andy\vb5\")
Set rsMain = dbMain.OpenRecordset("Hkdict")

But I was prompted "run-time error '3055': Not a valid file name" . I've double checked that the path and filenames are all correct. How can I correct this problem? Thank you very much.

Andy Cheung