Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011

    Unanswered: Print Current Report via Command Button


    I've set up a report that is activated when a command button is pushed (onclick) from a form.

    My idea was to print a single report from the form record that is shown keyed off of an ID. And it does kind of work but but when press the print button a message box shows up asking to "Enter Parameter Value".

    this is the VBA code:
    HTML Code:
    DoCmd.OpenReport "Buyer", acPreview, , "[Buyer_ID] =" & Me.[Buyer_ID]
    The odd thing is that the Buyer ID of the record I want shows on the "Enter Parameter Value" message box and, for some reason, when I enter that exact same number the report shows exactly as I want it.

    How do I get rid of that annoying message box?

    Please let me know if this is hard to understand... it's certainly hard to explain. Thanks.

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I suspect that you're entering the data in your Record and then the Command Button code is being invoked, before the Record has been saved! Hence the Buyer_ID is not available; it's not stored in the Table!

    In the Command Button, immediately prior to you current code, add

    If Me.Dirty Then Me.Dirty = False

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jul 2011
    Thanks, Linq (as always).

    The records were saved before trying to print but the message box was still showing was still showing. I will keep working on it. Funny thing, I removed the code, saved it, and re-entered the code and now it's acting differently. Now it's showing the report without the message but it's showing all reports instead of just the one record that is currently active (showing) in the form.

    Me? At wits end. I've tried several different code (seems like everyone has a different approach) but none do what I need.

    I've attached the file if you want to take a look.

    Thanks so much.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

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