Results 1 to 11 of 11
  1. #1
    bosve73 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    22

    How to print multiple labels of one record from a form

    Hi
    I have made a program for printing labels i access 2003 and now the only thing I have left is how to print multiple records of one label?. .
    I have a very simple database with one table, one form and one report. I would like to have a control box in the form for how many labels I want to print. I have been searching on internet for tutorials and find some but as I am new to Access and programming the tutorials have been very difficult to follow.

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    The easiest way that I have found to do this is to have a form where the user would select the record they want printed and an unbound text box where they would enter the # of labels they need. The procedure would then take that # of labels entered and do an interation where an append query would be ran each time and the record would be appended to a temporary table that would be used as the record source in your report that has the labels.

  3. #3
    bosve73 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    22
    Quote Originally Posted by Datagopherdan View Post
    The easiest way that I have found to do this is to have a form where the user would select the record they want printed and an unbound text box where they would enter the # of labels they need. The procedure would then take that # of labels entered and do an interation where an append query would be ran each time and the record would be appended to a temporary table that would be used as the record source in your report that has the labels.
    I know how to make a form and insert a text box but I don't understand the rest of the procedure.

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    The syntax would be just this.
    Code:
      Dim intCount As Integer
      For intCount = 1 To Me!txtNumPrint.Value
       CurrentDB.Execute "qapp_MyLabels"
      Next
    "qapp_MyLabels" is a query that appends the information needed for the labels to a temporary table. It just iterates up to the count that is entered in the text box and will run the query that # of times. You would just need to delete the records in the temp table before you run it each time.

    Quote Originally Posted by bosve73 View Post
    I know how to make a form and insert a text box but I don't understand the rest of the procedure.

  5. #5
    bosve73 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    22
    Quote Originally Posted by Datagopherdan View Post
    The syntax would be just this.
    Code:
      Dim intCount As Integer
      For intCount = 1 To Me!txtNumPrint.Value
       CurrentDB.Execute "qapp_MyLabels"
      Next
    "qapp_MyLabels" is a query that appends the information needed for the labels to a temporary table. It just iterates up to the count that is entered in the text box and will run the query that # of times. You would just need to delete the records in the temp table before you run it each time.
    Ok I understand the process now but where do I insert this code and how do I connect the function to the textbox?

  6. #6
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    You would just create a command button and insert that on the button's "On Click" event. "txtNumPrint" just refers to the name of the unbound text box where the users would enter how many labels they want printed.

    Quote Originally Posted by bosve73 View Post
    Ok I understand the process now but where do I insert this code and how do I connect the function to the textbox?

  7. #7
    bosve73 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    22
    Quote Originally Posted by Datagopherdan View Post
    You would just create a command button and insert that on the button's "On Click" event. "txtNumPrint" just refers to the name of the unbound text box where the users would enter how many labels they want printed.
    I did that and I got error message:
    Run time error 438
    Object doesn't support this property or method


    Private Sub Command50_Click()
    Dim intCount As Integer
    this is the line that is highlighted---> For intCount = 1 To Me!HowManyLabelsText.Value
    CurrentDb.Execute "qryMogel"
    Next
    End Sub

  8. #8
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    It looks good. Do you have an unbound text box on that form called "HowManyLabelsText"?

    Quote Originally Posted by bosve73 View Post
    I did that and I got error message:
    Run time error 438
    Object doesn't support this property or method


    Private Sub Command50_Click()
    Dim intCount As Integer
    this is the line that is highlighted---> For intCount = 1 To Me!HowManyLabelsText.Value
    CurrentDb.Execute "qryMogel"
    Next
    End Sub

  9. #9
    bosve73 is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    22
    Quote Originally Posted by Datagopherdan View Post
    It looks good. Do you have an unbound text box on that form called "HowManyLabelsText"?
    Yes I have a unbound text box named "HowManyLabelsText"

  10. #10
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Instead of using CurrentDB.Execute, try this

    Docmd.Open "qryMogel"

    This is not the preferred method of doing it. Sometimes for whatever reason, I have found that CurrentDB throws errors like that. Let me know if it works that way. Also, "qryMogel" is an append query, correct?


    Quote Originally Posted by Datagopherdan View Post
    It looks good. Do you have an unbound text box on that form called "HowManyLabelsText"?

  11. #11
    PrintShopSup is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    11
    Datagopherdan, I am getting this concept to work for setting up my table which will make the labels. Is there a way to pass a calculation to the query when (or before) It is opened?

    For example, if the user enters the quantity per box and how many boxes, can a calculation be made for the "last box" which may have a smaller qty (remainder). I am also interested in putting "box xx of xx" on the label so I know I will need to pass another piece to the query before it appends to the table.

    Any ideas?

    **UPDATE**

    Tried setting up an unbound text box (will be hidden when completed) which is used for the box number (box xx of xx). set the txtbox to the count in the loop and passed that in the query that opens. Got my expected results. I will attempt another calculation for current box qty (remainder calc) when I get more time.
    Last edited by PrintShopSup; 11-24-2010 at 04:55 AM. Reason: Update

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Print a specific record report from a form
    By cynthiacorley in forum Reports
    Replies: 27
    Last Post: 02-08-2010, 06:34 AM
  2. Replies: 1
    Last Post: 02-03-2010, 08:17 AM
  3. Replies: 1
    Last Post: 12-10-2009, 08:41 PM
  4. Print a different image per record
    By mcaldwell in forum Reports
    Replies: 5
    Last Post: 04-24-2009, 02:00 PM
  5. cannot print labels
    By Diane in forum Database Design
    Replies: 4
    Last Post: 12-29-2005, 08:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums