PDA

View Full Version : VBA and ODBC linking problem



greenmtnsun
12-08-2004, 02:45 PM
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 (http://www.tek-tips.com/viewthread.cfm?qid=964725&page=1#) 1997 to Access 2000 (http://www.tek-tips.com/viewthread.cfm?qid=964725&page=1#) and from foxpro 2.6 to visual foxpro 8.0. With the switch, we figured we would connect to the database (http://www.tek-tips.com/viewthread.cfm?qid=964725&page=1#) 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

hunteroftheshadows
01-20-2005, 09:04 AM
have you tried declaring the string before those lines?

Dim folder$ As String

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


HTH

-hunter

"Those who reject enlightenment embrace destruction"