Đang chuẩn bị liên kết để tải về tài liệu:
access 2007 vba bible phần 7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Nếu bạn chạy lệnh này trong một cơ sở dữ liệu mà không có bảng liên kết, thay vì bạn sẽ nhận được các tin nhắn được hiển thị trong hình Hình 15,21 Một tin nhắn khi cố gắng để sao lưu kết thúc trở lại cho một cơ sở dữ liệu mà không có bảng liên kết | Going Beyond the Basics 12 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 GetDocumentsPath function that retrieves the Documents path from tblInfo is listed next the GetTemplatesPath function is similar Public Function GetDocumentsPath As String On Error GoTo ErrorHandler Set dbs CurrentDb Set rst dbs.OpenRecordset tblInfo 413 Part II Writing VBA Code to Exchange Data between Office Components rst.MoveFirst GetDocumentsPath rst DocumentsPath rst.Close ErrorHandlerExit Exit Function ErrorHandler MsgBox Error No Err.Number Description Err.Description Resume ErrorHandlerExit End Function Figure 12.7 shows a page of shipping labels. FIGURE 12.7 A set of Word shipping labels filled with data from Access. 414 Going Beyond the Basics 12 Every development project has unique requirements when using Access to create mailing labels or any other type of Word documents you have the freedom to create tables and forms that exactly meet your needs storing all and only the information you need to select and print the data you need on Word documents. The code used to create the shipping labels described in this section includes several techniques that are useful for producing Word documents of various types such as creating filtered recordsets for working with detail records calculating x of y numbers when working with sets of records displaying a progress meter in the status bar and updating tables from code. Creating Excel Pivotcharts from Access Queries You can create .