Delete new jobs tables
DoCmd.DeleteObject acTable, “tblNewJobs”
DoCmd.DeleteObject acTable, “tblNewJobsDB”
End Sub
The “Inspect New Jobs from App File” button’s event procedure first checks that an application file
has been selected, parses out the file path and file name for use in different arguments of the
TransferDatabasestatement, then sets up a Select Casestatement to do the import
differently for the three application types:
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 strDBPath As String
Dim strDBName As String
Dim strAppFileAndPath As String
Set txtData = Me![txtSelectedAppFile]
strAppFileAndPath = Nz(txtData.Value)
If strAppFileAndPath = “” 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 file path and file name.
strDBPath = SplitDBPath(strAppFileAndPath)
Trim off last backslash.
Debug.Print “DB path length: “ & Len(strDBPath)
strDBPath = Left(strDBPath, Len(strDBPath) - 1)
strDBName = SplitDBName(strAppFileAndPath)
End If
Part II Writing VBA Code to Exchange Data between Office Components