Results 1 to 3 of 3

Thread: FoxPro to VB

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    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.
    Code:
    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
    Code:
    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:

    Code:
    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).]

  2. #2
    New Member
    Join Date
    Jul 1999
    Location
    Glendale Hts, IL USA
    Posts
    15

    Post

    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

  3. #3
    Member
    Join Date
    Jun 2000
    Location
    Hong Kong
    Posts
    62

    Question

    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
    Please Visit My WebCam!!
    http://www.hmcheung.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width