Access.2007.VBA.Bibl..

(John Hannent) #1
Case 1
HTML
DoCmd.TransferText transfertype:=acImportHTML, _
TableName:=strTable, _
FileName:=strHTMLXMLFileAndPath, _
hasfieldnames:=True

Assign the appropriate form as the subform’s source object.
Me![subNewJobs].SourceObject = “fsubNewJobs”

Case 2
XML
ImportXML DataSource:=strHTMLXMLFileAndPath, _
importoptions:=acStructureAndData
DoCmd.SetWarnings False

There is no argument for specifying the name of the table that is
created when an XML file is imported; it comes in as the name
stored in the XML file (usually the XML file name), possibly with
a number added on.
DoCmd.Rename newname:=strTable, objecttype:=acTable, _
oldname:=strHTMLXMLFile

Assign the appropriate form as the subform’s source object.
Me![subNewJobs].SourceObject = “fsubNewJobs”

End Select

ErrorHandlerExit:
Exit Sub

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

End Sub

Exporting HTML and XML Files..............................................................................


If you want to experiment with exporting Access data to HTML or XML files, try the Export Job
Data to HTML or XML File form. If you select the “Export HTML or XML Data” option on the
main menu (see Figure 10.10) and click the button to its left, the Export Job Data to HTML or


Working with External Data 10

Free download pdf