Access.2007.VBA.Bibl..

(John Hannent) #1
Lotus 1-2-3

strAppFile = strOutputPath & “\Jobs.wk1”
DoCmd.TransferSpreadsheet transfertype:=acExport, _
spreadsheettype:=acSpreadsheetTypeLotusWK1, _
TableName:=strQuery, _
FileName:=strAppFile, _
hasfieldnames:=True

End Select

strTitle = “Exported jobs”
strPrompt = “Exported filtered jobs to “ & strAppFile
MsgBox strPrompt, vbInformation + vbOKOnly, strTitle

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit

End Sub

Working with XML and HTML Files ................................................................................


Sometimes Microsoft introduces a new technology long before it has any real-world use. The XML
and HTML file formats, though very useful for developing web sites, to date lack utility as vehicles
for exporting or importing Access data. XML in particular appears to be a new technology (not that
new; it was introduced in Office XP) that as of yet doesn’t have much use for Access data import
and export, though perhaps it will in the future. As far as I can see, any Access-related data
exchange tasks that you can do with XML or HTML can be done better by other methods, such as
the comma-delimited or worksheet formats.

That said, you may need to export an Access table or query to HTML format for posting on a web
site; XML files, though perhaps promising for future use, are at present minimally useful for
importing or exporting Access data.

Importing HTML and XML Files ............................................................................


If you do need to import data into Access from an HTML or XML file (or just want to experiment with
these options) you can use the Import HTML or XML Job Data form (frmImportHTMLXMLData),
which opens if you select the Import HTML or XML Data option on the main menu and click the
button to its left (see Figure 10.11).

Clicking the “Inspect New Jobs from HTML File” button displays the imported records in the sub-
form, as shown in Figure 10.24.

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf