I'm attempting to link to a table from a Foxpro database. I will need to do this using VBA.
The Foxpro database is TOTALS.DBF. The table is called Totals.
Right now I have the following code:
Code:
Private Sub cmdLink_Click()
Dim dbsTemp As Database
Dim strMenu As String
Dim strInput As String
Set dbsTemp = CurrentDb
ConnectOutput dbsTemp, _
"LinkedTable", _
";DATABASE=C:\TOTALS.DBF", _
"Totals"
End Sub
Sub ConnectOutput(dbsTemp As Database, _
strTable As String, strConnect As String, _
strSourceTable As String)
Dim tdfLinked As TableDef
Set tdfLinked = dbsTemp.CreateTableDef(strTable)
tdfLinked.Connect = strConnect
tdfLinked.SourceTableName = strSourceTable
dbsTemp.TableDefs.Append tdfLinked
End Sub
Executing the above gives the following error:
"Unrecognized database format TOTALS.DBF"
I realize that I somehow need to tell it to link to a Foxpro table. Can someone give me the correct syntax?
Any other suggestions are welcome. I've already tried unsuccessfully importing the table to Access.