Results 1 to 3 of 3

Thread: How to pass parameters to Access

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Location
    Rafaela (Argentine)
    Posts
    107

    Question

    How could I pass parameters to an Access report, so it uses them as filters for the query/table in which is based?
    I have an Access report which lists records containing a Date/Time column. How could I filter that report from VB, so it only shows the period of time I want?
    Thanks in advance.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I never used reports in Access so I don't know what I'm talking about!

    Anyway...

    What you could do is have a table with a field on it into which you can insert (from VB) a filter string.
    Then, alter you report or whatever to read the filter string from the table instead of from a parameter.


    Hmmm... that almost sounded as though I knew what I was talking about.
    Mark
    -------------------

  3. #3
    Fanatic Member
    Join Date
    Sep 2000
    Location
    Over There
    Posts
    522

    Red face

    I've done this thing before, its fairly simple.
    In this example my report was just based on a parameter query with recnum being its parameter. The report just gave me info about a particular record.
    I belive the AcViewNormal causes the report to print.
    there are parameters that allow you to preview it first.
    This should give you the basics do help in access on openreport and it should giveyou the info you need.

    Private Sub PrintLog_Click()
    On Error GoTo exit_sub
    Screen.MousePointer = vbHourglass
    Dim objAccess As Object

    Set objAccess = GetObject(probdb, "Access.Application")
    objAccess.DoCmd.OpenReport "Problems", acViewNormal, , "[recnum] = " & RecNum
    Set objAccess = Nothing 'end the OLE Automation session
    Screen.MousePointer = vbDefault
    Exit Sub
    exit_sub:
    Set objAccess = Nothing
    Call app_err(Err.Number, Err.Description, Me.Caption)
    Screen.MousePointer = vbDefault
    End Sub


Posting Permissions

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



Click Here to Expand Forum to Full Width