• Printing some labels (Access 2000)

    • This topic has 6 replies, 3 voices, and was last updated 21 years ago.
    Author
    Topic
    #404975

    I have a form, based on a query which returns a subset of people
    I have a button to produce address labels using a report created by the wizard
    Clicking the button produces labels for every person inthe database
    I know how to produce a label for one individual but how can I limit the labels to those that are produced by the query

    Viewing 5 reply threads
    Author
    Replies
    • #828026

      Follow these steps:

      1. Open db with “Queries” selected in Objects pane.

      2. Select query to be used as RecordSource for label report.

      3. From Select Object list (Database toolbar) select “Report”. Or, select “Report” from Insert menu.

      4. New Report dialog will open. Select “Label Wizard” from list of options. The query you selected should appear in the “Choose table or query” combobox.

      5. “Label Wizard” dialog will open. Follow instructions to create new label report based on specified query.

      6. Click “Finish” button when done. New report will be created, reflecting the options you selected in “Wizard.”

      7. View report in design or preview mode, and make any necessary changes to formatting, etc.

      8. Print labels.

      HTH

    • #828027

      Follow these steps:

      1. Open db with “Queries” selected in Objects pane.

      2. Select query to be used as RecordSource for label report.

      3. From Select Object list (Database toolbar) select “Report”. Or, select “Report” from Insert menu.

      4. New Report dialog will open. Select “Label Wizard” from list of options. The query you selected should appear in the “Choose table or query” combobox.

      5. “Label Wizard” dialog will open. Follow instructions to create new label report based on specified query.

      6. Click “Finish” button when done. New report will be created, reflecting the options you selected in “Wizard.”

      7. View report in design or preview mode, and make any necessary changes to formatting, etc.

      8. Print labels.

      HTH

    • #828038

      Another way is to create a WhereCondition string you can use in your OpenReport method. Let’s assume the Primary Key field is named ID, and is a number. You want to produce a string that looks something like this:
      ID in (1,5,7,100,2500)

      This code will create that string (this will fail if the # of ID causes, the string to exceed it max length, which is some 4000 characters):

      dim strIN as string

      strIN = “ID in (”
      with Me.recordsetclone
      .moveFirst
      Do While .EOF=False
      strIN = strIN & ID & “,”
      .MoveNext
      Loop
      strIN = strIN & “)”
      End With

      DoCmd.OPenReport “rptLabels”,wherecondition:=strIN

    • #828039

      Another way is to create a WhereCondition string you can use in your OpenReport method. Let’s assume the Primary Key field is named ID, and is a number. You want to produce a string that looks something like this:
      ID in (1,5,7,100,2500)

      This code will create that string (this will fail if the # of ID causes, the string to exceed it max length, which is some 4000 characters):

      dim strIN as string

      strIN = “ID in (”
      with Me.recordsetclone
      .moveFirst
      Do While .EOF=False
      strIN = strIN & ID & “,”
      .MoveNext
      Loop
      strIN = strIN & “)”
      End With

      DoCmd.OPenReport “rptLabels”,wherecondition:=strIN

    • #828557

      Thanks for the replies – my mistake was creating the form based on the table – not the query – it’s now working fine

    • #828558

      Thanks for the replies – my mistake was creating the form based on the table – not the query – it’s now working fine

    Viewing 5 reply threads
    Reply To: Printing some labels (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: