Access.2007.VBA.Bibl..

(John Hannent) #1
& “order shipped on “ _
& Format(Date, “dd-mmm-yyyy”)
MsgBox strPrompt, vbInformation, strTitle

ErrorHandlerExit:

Figure 12.6 shows the “Finished!” message after all the sets of labels have been created.

FIGURE 12.6

The success message after all labels have been printed.


Clear the progress meter:

Application.SysCmd acSysCmdClearStatus

Exit Sub

ErrorHandler:
If Err = 429 Then

Word is not running; open Word with CreateObject:

Set appWord = CreateObject(“Word.Application”)
Resume Next
Else
MsgBox “Error No: “ & Err.Number & “; Description: “ _
& Err.Description
Resume ErrorHandlerExit
End If

End Sub

The GetDocumentsPathfunction that retrieves the Documents path from tblInfo is listed next;
the GetTemplatesPathfunction is similar:

Public Function GetDocumentsPath() As String

On Error GoTo ErrorHandler

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(“tblInfo”)

Going Beyond the Basics 12

Free download pdf