![]() Rst.Open "", CurrentProject.Connection, adOpenDynamic, _ adLockPessimistic MsgBox "Please indicate the number of labels you want to print", _ 'If set to 0, label report is blank but runs. 'Print multiple labels for current record.ĭoCmd.RunSQL "DELETE FROM " Private Sub cmdPrintMultipleLabels_Click() If you’re working with your own data, be sure to update the field and table names, accordingly.įigure C Enter a sub procedure for the button’s Click event. cls module, also included in the download. Copy it from the downloadable database file or import the. Choose from the On Click’s dropdown list ( Figure C) and click the Builder button to open the form’s module.With the button selected, click the Event tab in the Property sheet.Add a command button name it cmdPrintLabels and enter a caption of Print Multiple Labels.Enter the caption text Number of Labels.Add a text box control to the Form Header section and name it txtNumberofLabels.To customize the form to fit the task, add a text box, a command button, and some code as follows: Remove unnecessary fields or not-the code will reference only those fields you want to include in the label report. ![]() The form will display all the records in the Customers table so you can choose. ![]() Use the Form Wizard to create a simple form based on the Customers table (not the temporary table). Figure B Base a label report on the temporary table. In Access 2016, the wizard is in the Reports group on the Create tab. Name the report Customer Label Report ( Figure B). Add the following fields: CustomerID, CompanyName, Address, City, Region, PostalCode, and Country. Next, use the Labels report wizard to generate a report on the temporary table, Temporary Customers. You can delete them if you like, but they’re harmless. Don’t worry if the temporary table contains fields you don’t need for the label report. The code will duplicate records, and these table properties will generate errors. In addition, make sure none of the fields is required and none has an index. If you copied the Customers table, open the copy in Design view and delete the primary key.
0 Comments
Leave a Reply. |