tailieunhanh - access 2007 vba bible phần 7

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 shows the Finished message after all the sets of labels have been created. FIGURE The success message after all labels have been printed. Clear the progress meter acSysCmdClearStatus Exit Sub ErrorHandler If Err 429 Then Word is not running open Word with CreateObject Set appWord CreateObject Resume Next Else MsgBox Error No 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 tblInfo 413 Part II Writing VBA Code to Exchange Data between Office Components GetDocumentsPath rst DocumentsPath ErrorHandlerExit Exit Function ErrorHandler MsgBox Error No Description Resume ErrorHandlerExit End Function Figure shows a page of shipping labels. FIGURE 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 .

TỪ KHÓA LIÊN QUAN