Results 1 to 2 of 2

Thread: Parameters Form

  1. #1
    Join Date
    Jun 2010
    Posts
    3

    Parameters Form

    I have a form set up for the user to enter the parameters for an underlying query. The first text box asks for a report number, and the second asks for a name. If they enter one or the other, it works great. I would like to add the option for the user to leave both boxes blank to see the most recent report built upon the query. When I try it now, I just get a blank report. The Report Number field in the query is sorted decending, so the first record would be the most recent report. How can I set up this third option to work correctly?
    Thanks for your help.

  2. #2
    Join Date
    May 2006
    Posts
    407
    If Len(Me.Text1) = 0 and Len(Me.Text2) = 0 then
    Me.Text1 = DMax("ReportNumber, "qryReportQuery")
    EndIf
    Text1 is the Report Number field on the form
    Text2 is the Report Name field on the form
    "ReportNumber" would be whatever name the report number has in the query.
    "qryReportQuery" should be the actual name of the query you are talking about.
    Because you said the query is sorted descending, that tells me the largest Report Number is the most recent report, therefore, the DMax() function will give you that report number, which when put into the Report Number field of the form will then allow your form to work the way it has been working.

Posting Permissions

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