Access.2007.VBA.Bibl..

(John Hannent) #1
When you import data from an XML file, there is no option for specifying the name of
the Access table; it will have the same name as the original data source, possibly with an
appended number.

The code for the “Inspect New Jobs From HTML File” button is listed below:

Private Sub cmdInspectJobs_Click()

On Error GoTo ErrorHandler

Dim strText As String
Dim strTitle As String
Dim strPrompt As String
Dim txtData As Access.TextBox
Dim strAppFile As String
Dim strTable As String
Dim strSpec As String
Dim strHTMLXMLFileAndPath As String
Dim strHTMLXMLFile As String
Dim strHTMLXMLPath As String

Set txtData = Me![txtSelectedAppFile]

strTable = “tblNewJobs”
strHTMLXMLFileAndPath = Nz(txtData.Value)
If strHTMLXMLFileAndPath = “” Then
strTitle = “No application file selected”
strPrompt = “Please select an application file”
MsgBox prompt:=strPrompt, Buttons:=vbExclamation _
+ vbOKOnly, Title:=strTitle
GoTo ErrorHandlerExit
Else
Parse out the file name; it is needed later in the procedure.
strHTMLXMLFile = SplitDBName(strHTMLXMLFileAndPath)

Trim off the file extension.
strHTMLXMLFile = Mid(strHTMLXMLFile, 1, InStr(1,
strHTMLXMLFile, “.”) @@hy 1)
Debug.Print “Trimmed file name: “ & strHTMLXMLFile
End If

intFileType = Nz(Me![fraFileType].Value, 1)

Select Case intFileType

NOTENOTE


Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf