Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2008, 02:26 PM
Registered User
 
Join Date: Aug 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linking to a Foxpro Table

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to link FoxPro Table with VB achour Pro VB Databases 2 September 14th, 2009 09:26 AM
Exporting Oracle Table to .dbf (FoxPro 2.6) File syamchandr Oracle ASP 2 December 12th, 2005 04:43 AM
Table designing and linking knight PHP Databases 0 January 17th, 2005 02:46 AM
Linking files to an access table william.murray Access VBA 0 November 5th, 2004 10:00 AM
Update SQL table with data from FoxPro system sofya SQL Server 2000 6 November 4th, 2004 06:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.