Results 1 to 5 of 5
  1. #1
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113

    Printing a Range of Invoices (Reports)


    Hello, as you can see I am new at programing. I would like to be able to print a range of invoices... I have OrderID and Invoice Number as unique fields for each record (invoice). So ideally I would like to enter on a form the starting Invoice Number, the ending invoice number, press a button and get all the invoices printed individually following the invoice number. Could you please help me in getting some code to do this? I was thinking of do loops, but I don't know how to implement them with the start and end invoice numbers. Thank you for your help.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The simplest would likely be to use the .Filter property of the report at the time you open the report. Here is an example using two unbound controls as user input for a date range.

    Code:
    If IsNull(Me.TextBoxName1) Or _
       IsNull(Me.TextBoxName2) Then
    MsgBox "Please enter Criteria"
    Exit Sub
    End If
    
    Dim strWhere As String
    strWhere = "[MyDateField] BETWEEN #" & Me.TextBoxName1 & "# AND #" & Me.TextBoxName2 & "#"
    DoCmd.OpenReport "ReportName", acViewPreview, , strWhere
    If you are using numbers and going after your primary key the syntax would be a little different. You would not use the date qualifiers (#).
    Code:
    strWhere = "[MyPKField] BETWEEN " & Me.TextBoxName1 & " AND " & Me.TextBoxName2

  3. #3
    ManuelLavesa is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    113
    Thank you ItsMe. It works well

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Glad to hear all is well.

  5. #5
    peiyezhu is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2015
    Posts
    8
    strWhere = "[MyPKField] BETWEEN # " & Me.TextBox & "#"....

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

Similar Threads

  1. Replies: 9
    Last Post: 04-21-2013, 05:37 PM
  2. Help printing off multiple reports.
    By MelonFuel in forum Forms
    Replies: 5
    Last Post: 06-29-2012, 12:25 PM
  3. Printing reports off a list box
    By kbandong1 in forum Reports
    Replies: 3
    Last Post: 03-05-2011, 09:51 PM
  4. Printing Invoices
    By Alex Motilal in forum Reports
    Replies: 4
    Last Post: 05-11-2010, 01:20 AM
  5. Printing Reports....
    By Danny Christie in forum Reports
    Replies: 1
    Last Post: 12-06-2006, 05:51 PM

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