Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    2

    Post Unanswered: Created a query that is displayed in a report - problem with parameters on printing

    Hello,

    I checked the section for a similar topic but couldn't really find what I am looking for.

    Here's the situation

    1) I have a client table.
    2) I created a query, called client profile, that takes its input from a couple of forms:
    a) When I add a client.
    b) When I am searching for a client.

    Here is a screenshot for the "criteria" in my query.

    screenshot_8-16-2011_4-04 AM.png

    3) I created a report called client profile and dragged the query created in (2). screenshot_8-16-2011_4-05 AM.png

    4) Note that when I try opening the report that has the query in it directly - several dialog boxes appear asking me for input (shown here: screenshot_8-16-2011_4-07 AM.png).

    5) Note that I have 2 forms: Search Client and Add Client. The report takes input from both. So when I submit the Search Client form, the dialog boxes in (4) appear asking for the input of the Add Client parameter and vice versa.

    The problem is:

    I have a button on the report and I want it to print the report just as it is displayed. But when I click on it having this code:

    Code:
    Private Sub Command11_Click()
        DoCmd.OpenReport "patient Profile", acViewPreview, , , acWindowNormal
    End Sub
    The dialog boxes appear asking me for the input parameters and if i skip them the report is just empty. I want to print the report without having to re-enter the parameters by passing parameters or with any possible way. Also, if it's possible - if one of the parameters is submitted don't display the dialog boxes for the others.

    Thank you in advance and sorry for the very - long - description.
    Last edited by GalalAly; 08-15-11 at 23:25.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I have a button on the report and I want it to print the report just as it is displayed. But when I click on it having this code:
    I guess you mean on the form

    As the query contains references to controls from one or several form(s), this/these form(s) must be open when the query is being executed. If not, these references are treated as parameters and you are asked to input their values.
    Have a nice day!

  3. #3
    Join Date
    Aug 2011
    Posts
    2
    Actually I meant on the report =D

    Anyway, Your answer gave me a hint .. I had to open the form (from the code), assign the parameters to that already displayed to avoid having the dialog boxes again. Thanks a lot for your help

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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