Results 1 to 3 of 3
  1. #1
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228

    Question report prints label for every record instead of just one!!

    hello good people,



    i have a report that is meant to print out a label with information on a form.
    In my form, i have a "Save, Print, Exit" button. in short, this button prints out info from my form.

    i have a query feeding information to the report with what it is supposed to pring out.

    i dont want a label for every record, only for the one just entered.

    here is my VBA code:
    ps. my Save Print Exit button calls the PrintLabels func.

    Private Function PrintLabels()
    Dim Show_Box As Boolean
    Dim Response As Variant
    Dim i As Integer

    ' Set the Show_Dialog variable to True.
    Show_Box = True

    ' Begin While loop.
    While Show_Box = True

    ' Show the input box.
    Response = InputBox("Enter the number of labels to print or press Cancel to skip printing.", "Label Printing", 1)

    ' See if Cancel was pressed.
    If Response = "" Then

    ' If Cancel was pressed,
    ' break out of the loop.
    Show_Box = False
    Else
    ' Test Entry to find out if it is numeric.
    If IsNumeric(Response) = True Then
    For i = 1 To Response
    DoCmd.OpenReport "rpt_dicing_label", acViewNormal, , "[ID]=" & Me.ID
    Next i
    Show_Box = False
    Else
    ' If the entry was wrong, show an error message.
    MsgBox "Please Enter Numbers Only"
    End If
    End If
    ' End the While loop.
    Wend
    End Function



    HELLLLLPP!!?!?!??!???

  2. #2
    Join Date
    May 2010
    Posts
    339
    Hi mejia.j88

    The code I use to print out labels checks to see if the form holds records, if it does it will print out the number of labels in my texbox named TotalParcels. This is not as complex as your code but it might help you with ideas.



    Private Sub Command36_Click()
    On Error GoTo Err_Command36_Click

    Dim strWhere As String
    Dim L As Long

    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If

    If Me.NewRecord Then
    MsgBox "Select a record to print"
    Else

    strWhere = "[MemoID] = " & Me.[MemoID]
    For L = 1 To Me!TotalParcels
    DoCmd.OpenReport "rptMemoDymo", acViewNormal, , strWhere
    Next L

    End If
    Exit_Command36_Click:
    Exit Sub


    Err_Command36_Click:
    MsgBox Err.Description
    Resume Exit_Command36_Click

    End Sub

  3. #3
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    Late update:

    the problem was that my code prints the [ID] being used on the current form, i didnt have that on my form as a field so i added it. that way the code was able to pick up which [ID] belongs to the current record, and therefore printing that record only as opposed to all of them.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-17-2011, 02:38 PM
  2. Change way report prints
    By johnpaul in forum Reports
    Replies: 1
    Last Post: 10-01-2010, 11:17 AM
  3. underlying form prints instead of report
    By usmcgrunt in forum Reports
    Replies: 1
    Last Post: 09-17-2010, 05:22 AM
  4. Report Prints Out Before Previewing
    By Schwagr in forum Reports
    Replies: 2
    Last Post: 03-18-2006, 02:15 PM
  5. report prints blank page at end of report
    By darrellx in forum Forms
    Replies: 0
    Last Post: 03-14-2006, 08:51 PM

Tags for this Thread

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