Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2012
    Posts
    22

    Unanswered: Filtering a form upon opening it

    Hi guys,

    I have a report that I use in conjunction with a form to create customer invoices. However when I open the report it shows me every record, which in turn shows me every invoice that has been created, however I would like it so when I open it up it asks for the invoice number.
    I have seen this code (Modified for my own fields) and to put it in the WHERE condition of openreport:
    DoCmd.OpenReport "rptCustomerInvoice", , , "InvoiceNumber=" & Me.InvoiceNumber

    However I have no idea what openreport is or where to put this code.
    I have also noticed on a form, when I open it, it already has the fields set to the first record in the table it's linked to what would I have to put into the "OnLoad" section of the form property sheet to make it clear (I currently have a button for this)

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Look at "DemoInvoiceNumberA2003.mdb" (attachment, zip).
    There are 1 Table, 2 Queries, 2 Forms, 2 Reports.
    There are 2 ways to solve this problem.
    Look at Table1 "InvoiceNumber" field.
    Open Form1 or Form2 and try.
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2012
    Posts
    22
    Quote Originally Posted by MStef-ZG View Post
    Look at "DemoInvoiceNumberA2003.mdb" (attachment, zip).
    There are 1 Table, 2 Queries, 2 Forms, 2 Reports.
    There are 2 ways to solve this problem.
    Look at Table1 "InvoiceNumber" field.
    Open Form1 or Form2 and try.
    After looking through your database I've finally got it working thank you
    Also is there any way of having the enter invoice number as a combo Box as this banks on you knowing the invoice number and having something like a combo box that shows the invoice numbers and the dates and the company it's assigned to.
    Though I think this may be complicating things a little too much
    Last edited by Kisageru; 10-17-12 at 09:43.

  4. #4
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Use a way 1 or way 2, as you want.
    Look at Queries.

  5. #5
    Join Date
    Sep 2012
    Posts
    22
    Quote Originally Posted by MStef-ZG View Post
    Use a way 1 or way 2, as you want.
    Look at Queries.
    I have used way 2 and this does what I want but much easier!

    Thank you MStef-ZG
    Last edited by Kisageru; 10-17-12 at 10:33.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •