Link to home
Start Free TrialLog in
Avatar of ataripirate
ataripirateFlag for United States of America

asked on

FoxPro DBF file connection in VB6

NT 4.0
VB6.0


I have a data connection on my form.  I set it up for Connect: Foxpro 3.0
DatabaseName: H:\DBF\CK\TewameterTM210 NT
Default Type: 2-Use Jet
Record Source:

I left the record source blank, I want to change it to different DBF files druing the execution of the program.
If I fill it in it works ok.  But If I assign a value to it during execution, it does not work?

Foxpro code:
TewameterFile.RecordSource = "4711561"
TewameterFile.Recordset.MoveFirst

When I execute the code above I get an error when I try to 'movefirst' or any other command on the database

error: Object variable or With Block varible not set

I need to get data from the DBF file and then open the next and read data and so on....

I set up my access tables this way:
**** Access Code ****
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
Dim objrs As ADODB.Recordset

dbSrc = MyCurrentDataBase
 
cnn.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & dbSrc

 strsql = "SELECT `Test Information`.`Test Number`," & _
          "`Test Products`.ProdID, `Test Information`.Status," & _
          "`Test Information`.NT " & _
          "From `Test Information`, `Test Products`" & _
          "WHERE `Test Information`.`Test Number`=`Test Products`.`Test Number`" & _
          "and `Test Information`.`Status` > 2"


Set objrs = cnn.Execute(strsql)
***** End Access Code *****

I would set up the foxpro dbf this way, but I am not sure of the open parameters to do so.  I am  trying to update my mdac and jet files to include jet 4.  looking at other examples, I did not know if this was needed.  I have tried other examples given, but none of them seem to work.

if you need more info, just ask...

thanks
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland 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