Consulting

Results 1 to 2 of 2

Thread: VBA and ODBC linking problem

  1. #1

    VBA and ODBC linking problem

    Hi there,

    I am kinda new to my job and I was asked to resolve a propblem in VBA code that isn't working. We recently converted from Access 1997 to Access 2000 and from foxpro 2.6 to visual foxpro 8.0. With the switch, we figured we would connect to the database through ODBC. The following command in Access 97 was working but the new (and the old) one fails to work in 2000.

    OLD CODE:
    folder$ = "\\leviathn\cts_data\hospdata\wlv"
    DoCmd.TransferDatabase A_ATTACH, "foxpro 2.6", folder$, A_TABLE, "PICARCH", "PICARCH"

    NEW CODE
    folder$ = "\\leviathn\cts_data\hospdata\wlv"
    DoCmd.TransferDatabase acLink, "ODBC Database", folder$, acTable, "PICARCH", "PICARCH"

    The new command is doing nothing visible and its not clear as to why the table can't be linked to, its unclear if anything happens, except that I can send a text message to the console right after the command with MsgBox. We are able to link to the table if I manually conect to it through link tables >> ODBC Database() >> Machine Data Source >> Visual FoxPro Tables >> Free Table Directory >> {typing in the path} >> then selecting the object to import, in this case its "PICARCH". The PICARCH File is named picarch.dbf.

    Any ideas?

    Thanks a million!
    Keith

  2. #2

    try declaring the string

    have you tried declaring the string before those lines?

    Dim folder$ As String

    folder$=..........
    ........


    HTH

    -hunter

    "Those who reject enlightenment embrace destruction"

Posting Permissions

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