Access.2007.VBA.Bibl..

(John Hannent) #1
strOutputPath = GetOutputDocsPath()

Select Case intFileType

Case 1

HTML

strFileName = “Jobs.htm”
strFileNameAndPath = strOutputPath & strFileName
DoCmd.TransferText transfertype:=acExportHTML, _
TableName:=strQuery, _
FileName:=strFileNameAndPath, _
hasfieldnames:=True

Case 2

XML

strFileName = “Jobs.xml”
strFileNameAndPath = strOutputPath & strFileName
ExportXML objecttype:=acExportQuery, _
DataSource:=strQuery, _
datatarget:=strFileNameAndPath

End Select

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

ErrorHandlerExit:
Exit Sub

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

End Sub

If you open an XML file in IE 7, running on Windows Vista, you’ll see a yellow bar with a security
warning. If you click the bar you can select to allow blocked content, as shown in Figure 10.28.

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf