Access.2007.VBA.Bibl..

(John Hannent) #1

Exporting Database and Spreadsheet Files ..............................................................


These days, it isn’t very likely that you would need to export data from Access to a dBASE, Paradox,
or Lotus file (and in any case, as discussed in the “Exporting Text Files” section, you can export to a
comma-delimited text file that can be imported into those applications). However, Access still offers
the option of doing exports to these legacy applications, as discussed in this section.

If you select the “Export Data to App Files” option on the main menu and click the button to its left,
the Export Job Data to Application File form (frmExportAppData) opens. This form (much like the
Export Job Data to Text File form) lets you export a range of records filtered by date to a dBASE,
Paradox, or Lotus 1-2-3 file. Figure 10.23 shows filtered data ready to export to a dBASE file.

FIGURE 10.23
Filtered records for export to a dBASE file.

The “Clear Jobs to Export” button clears the selected records, and the “Export Jobs to Application
File” button does the export to a file of the selected format; this procedure is listed next. Similar to
the other export procedures, this procedure sets up a Select Casestatement to do the export
differently according to the selected application type; the TransferDatabasestatement with
various arguments:

Private Sub cmdExportJobs_Click()

On Error GoTo ErrorHandler

Dim intFileType As Integer
Dim strQuery As String

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf