Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2005
    Posts
    144

    Unanswered: Report doesnt get cancelled by clicking

    Hi all,
    I have a very simple question regarding access report.
    I have a report thats attached to a parameter query. If i dont enter any data and click cancel on the report button it prints the face of my form that has a focus.
    Intead I want this report to not print anything if i were to click the cancel button.
    Any help would be nice,
    Thanks

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    roll your own parameter form and don't call the report until you've received valid values for your desired arguments.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jul 2005
    Posts
    144
    Can be kind and tell me in more of easy steps. I am new to access and trying to learn it.
    Thanks again

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    might be worth looking at the reports 'nodata' event

    in the forms design panel, View | Code and look for the form OnNoData event

    highlight the nodata part of the function defintion and press the help key to provide more details of what you can do in this event.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jul 2005
    Posts
    144
    Thats not what i meant so let me explain a bit more in depth
    I have a report thats attached to a parameter query where parameters are entered by the user at run time into the default pop up box but if i dont type anything and click cancel it prints the face of a main form that has a focus.

    How can I prevent if from printing when i am clicking cancel and not entering any data.

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what are you doing with the cancel event
    what code are you executing with the cancel
    how are yiou painting the cancel button, are you using a message box
    how do you invoke the report print, and how do you handle null parameters
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Jul 2005
    Posts
    144
    Never mind i figured it out!
    Thanks

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you dont tell us what you were doing or how you fixed it - but at least you are happy.

    meanwhile, there was some good advice a few posts further up the thread: don't use parameter queries - use a form to gather parameters.

    you might ask why?

    first, you give the user an overview of the questions he needs to answer to get your query running. the salami-slice game of ever more parameter prompts is somewhere short of user-friendly

    second, you have a great home for your cancel button

    third, you have a chance to validate the user's input

    fourth, when the hapless user screws up and gets zero hits for his query, the criteria are still sitting there in front of his face so he can see what he did wrong and have another go by adjusting just one of the parameters, not typing in the full dozen salami-slice parameters.

    there are several more reasons including choice of sort, And/Or, handling null parameters, formatting date strings, combo choices, and so on...

    ...but you are happy already: that's cool too.

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Jul 2005
    Posts
    144
    First of all i would like to say that i am sorry for leaving like that its just that i was in a bit of a rush. What i have is your simple part number and serial database that collects these fields as we ship our items. I have been a big fan of this form obviously by reading and asking i was able to built my database. let me explain what i was doing and see if that make any sense.
    I have a button setup to print the orders by order number with a parameter query behind it. After pressing the button it executes the macro with openreport action with view set to print preview and secd action is print out, problem with that is when i dont type anything and simply click cancel it prints the main form page. Now all i did is deleted action printout and changed the view option for open report to print instead of view and it worked.

    Tell me if i did it the proper way.

    Thanks again
    PS: I dont know how to use a form to gather parameters?

  10. #10
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    PS: I dont know how to use a form to gather parameters?
    Create a form with controls (usually text boxes) for each "parameter".

    You can set properties of each control, such as "Format" to prevent things like the user entering "23/4-18" as a date.

    At the bottom of the form, you have a "Print" Button. Use the Control Wizard to put that button on so you get the basic code and then you can go into module view, check out the code, look in the help file and see how to add a "Where Clause" onto the OpenReport command so you can put your parameters on the report.

    good luck!
    tc

Posting Permissions

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