Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Input Box (2000 SR1)

    First of all, I am trying to re-use an existing query for a second report and do not want to change the query. However, I would like this new report to run based off of an input box. What is the code that has a user type in their value into an input box and then uses that answer as the criteria for the query.

    Am I making sense?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Input Box (2000 SR1)

    In your query, in place of a hard-coded selection criteria (such as ='FL'), use a prompt enclosed in brackets, something like =[Which state do you want?]. When this query is now run, it will pop the input box with the prompt "Which state do you want?".
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Input Box (2000 SR1)

    Thanks for your help. However, if I make that change to the query it will change another report and I don't want to touch that one.

    (I am trying to re-use the same query for 2 different reports.)

  4. #4
    New Lounger
    Join Date
    Feb 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Input Box (2000 SR1)

    use the Filter capability of the Report
    this example captures the Title to use as the criteria, however, if there is no criteria, then the Filter is turned off.

    Private Sub Report_Open(Cancel As Integer)
    Dim strFilter As String
    strFilter = InputBox("Enter Title Criteria", "Need Data")
    If strFilter <> "" And strFilter <> " " Then
    Me.Filter = "[Title] = '" & strFilter & "'"
    Me.FilterOn = True
    Else
    Me.FilterOn = False
    End If
    End Sub

    PaulF

  5. #5
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Input Box (2000 SR1)

    Yup, Paul's got it. Paul's post and my play time in mocking it up for you must've overlapped, and our methodology is slightly different, but I'm going to attach my dummy db anyhow. Do note that both of us have assumed that the 2d report will contain a subset of the first report.
    Attached Files Attached Files
    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

  6. #6
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Input Box (2000 SR1)

    Paul and Shane,

    Thank you - it works great. It's accomplishes exactly what I was trying to do.

Posting Permissions

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