Microsoft KB Archive/173879
Article ID: 173879
Article Last Modified on 7/1/2004
- Microsoft Visual FoxPro 3.0b for Macintosh
- Microsoft FoxPro 2.6a Professional Edition for Macintosh
This article was previously published under Q173879
Often, you have information in an Access table that needs to be imported into a FoxPro 2.x for the Macintosh or Visual FoxPro 3.0b for the Macintosh table. However, neither version of FoxPro offers a command that directly imports an Access table into a .dbf file nor is there a Macintosh-based ODBC driver available to read the Access data. This article provides several methods of accomplishing this task.
Since neither Visual FoxPro 3.0b for the Macintosh or FoxPro 2.x for the Macintosh has a method of importing Access tables, you must use the functionality of Access to create the .dbf table. Since Access is a Windows product, this article assumes the user has access to a Windows 95 or Windows NT machine.
The first method assumes that you have Visual FoxPro 3.x or 5.x for Windows. Since both versions of Visual FoxPro for Windows have ODBC drivers that interface with Access tables, one can create a remote view within Visual FoxPro to read the Access data and then save it to a .dbf file. The second method uses Access to save the file in a .dbf format. This method does not require one to install Visual FoxPro 3.x or 5.x for Windows.
- Create a new database called Ztest in Visual FoxPro 3.x or 5.x.
- In the database, right-click and select New Remote View.
- Select New View and then click Available data sources.
- Select the proper Access driver from the list. In this case, Access 7.0 database and click OK.
- If Microsoft Office 97 is installed, open the employee table contained in the Northwind.mdb (an Access database container) located in the program Files\Microsoft Office\Office\Samples folder. The exact path on a machine depends on the location of Microsoft Office.
- After adding the Employees table, click Close.
- Add the necessary fields using the Fields tab and execute the view.
Once the view returns the data, press the CTRL and F2 keys simultaneously to invoke the Command window and type the following:
COPY TO HOME()+"Temp.dbf"
In the Command window type the following (without the quotation marks):
Navigate to the Visual FoxPro home directory and locate Temp.dbf and select it.
- Type "BROWSE" (without quotation marks) in the Command window to see the Visual FoxPro table. Now copy the file to a disk or place it in a device that both a Windows and a Macintosh machine can access. Finally, copy the file to the appropriate folder on the Macintosh.
- Start Microsoft Access 97.
- Open the Access table that needs to be converted to a FoxPro table.
- From the File menu, select Save As/Export.
- Select "To an external database" and click OK.
- In the Save as Type list box, select either Microsoft FoxPro 2.6 (*.DBF) or Microsoft FoxPro 3.0 (*.DBF) and save the file.
- Place the new .dbf file on a disk or a device that is readable by a Macintosh machine. Copy the file to the desired Macintosh folder and open the file with FoxPro.
Access Online Help
Additional query words: Access
Keywords: kbhowto KB173879