Results 1 to 2 of 2
  1. #1
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    Open Report filtered by Date in ListBox

    I am trying to open a report showing only invoices from a date selected in a list box on the form. So the user selects the date, clicks the View Invoices button and the report displays only the invoices for the date selected. Problem is it is not showing any records. I've copied code from another post and added a Dim for my date field but it's not working I get a "Type" error in the first field of the report.

    Dim sReportName As String
    Dim sFilter As String
    Dim InvDt As Date



    InvDt = Me.lstInvDt.Column(0)

    sReportName = "rptInvoice"
    sFilter = "InvoiceDate = " & InvDt

    Stop

    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport sReportName, acPreview, , sFilter


    Any help is appreciated

  2. #2
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    Changed to a simple docmd and it worked

    Docmd.OpenReport "rptname", acViewpreview, "[date] in (#" & InvDt & "#)"

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

Similar Threads

  1. Open a report based on a filtered list box
    By irish634 in forum Access
    Replies: 5
    Last Post: 02-07-2012, 08:10 AM
  2. Sub form filtered by listbox
    By BorisGomel in forum Forms
    Replies: 3
    Last Post: 05-04-2011, 09:20 AM
  3. Open form to filtered records
    By ducecoop in forum Access
    Replies: 3
    Last Post: 10-22-2010, 10:53 AM
  4. Open a report with a date condition
    By Grooz13 in forum Reports
    Replies: 3
    Last Post: 08-02-2010, 02:35 PM
  5. Filtered Report
    By Desstro in forum Reports
    Replies: 3
    Last Post: 06-18-2010, 09:09 AM

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