Page 1 of 6 123 ... LastLast
Results 1 to 15 of 79
  1. #1
    Join Date
    Dec 2002
    Posts
    117

    Unanswered: Print Current Record

    I have a db...when a payment gets entered in....you click on a print button that sends the data to a report and prints out a receipt. Only it prints out all the records.

    What is the code to make the macro print just the current record?
    I know it something to do with a Where clause

    Thanks.

  2. #2
    Join Date
    Feb 2003
    Location
    Winston-Salem,NC
    Posts
    34

    Access Help

    PrintOut Action
    You can use the PrintOut action to print the active object in the open database. You can print datasheets, reports, forms, data access pages, and modules.

    Setting
    The PrintOut action has the following arguments.

    Action argument Description
    Print Range The range to print. Click All (the user can print all of the object), Selection (the user can print the part of the object that's selected), or Pages (the user can specify a range of pages in the Page From and Page To arguments) in the Print Range box in the Action Arguments section of the Macro window. The default is All.
    Page From The first page to print. Printing starts at the top of this page. This argument is required if you select Pages in the Print Range box.
    Page To The last page to print. Printing stops at the bottom of this page. This argument is required if you select Pages in the Print Range box.
    Print Quality The print quality. Click High, Medium, Low, or Draft. The lower the quality, the faster the object prints. The default is High.
    Copies The number of copies to print. The default is 1.
    Collate Copies Click Yes (collate the printed copies) or No (don't collate copies). The object may print faster if this argument is set to No. The default is Yes.

    Remarks
    This action is similar to selecting an object and then clicking Print on the File menu. With this action, however, no Print dialog box appears.

    Tip If you have particular print settings you use frequently, create a macro containing a PrintOut action with these settings in its arguments.

    The arguments for this action correspond to options in the Print dialog box. However, unlike the FindRecord action and Find In Field dialog box, the argument settings aren't shared with the Print dialog box options.

    To run the PrintOut action in Visual Basic, use the PrintOut method of the DoCmd object.

    Note** this is taken from MSAcess Help word for word.

  3. #3
    Join Date
    Dec 2002
    Posts
    117

    Gee Thanks

    If I knew how to read, I probably could have found that.

    Just kidding. I know that much. I am just trying to do an onOpen event procedure. I have this but it errors out:

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, CheckCreditCardNumber, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE PaymentID = " & Forms!frmPaymentsMyLineToo!PaymentID.Value

  4. #4
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: Gee Thanks

    Originally posted by jmonroe
    If I knew how to read, I probably could have found that.

    Just kidding. I know that much. I am just trying to do an onOpen event procedure. I have this but it errors out:

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, CheckCreditCardNumber, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE PaymentID = " & Forms!frmPaymentsMyLineToo!PaymentID.Value
    Your statement doesn't work because PaymentID=???????? You should put your " at the end and after the where (((PaymentID )=Forms!frmPaymentsMyLineToo!PaymentID.Value]))

    might work

  5. #5
    Join Date
    Dec 2002
    Posts
    117

    So...

    You are saying do this

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, CheckCreditCardNumber, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE (((PaymentID) = Forms!frmPaymentsMyLineToo!PaymentID.Value *

    Let me know.

  6. #6
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: So...

    Originally posted by jmonroe
    You are saying do this

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, CheckCreditCardNumber, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE (((PaymentID) = Forms!frmPaymentsMyLineToo!PaymentID.Value *

    Let me know.
    (((PaymentID) = Forms!frmPaymentsMyLineToo!PaymentID.Value))"

  7. #7
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Gee Thanks

    Originally posted by jmonroe
    If I knew how to read, I probably could have found that.

    Just kidding. I know that much. I am just trying to do an onOpen event procedure. I have this but it errors out:

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, CheckCreditCardNumber, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE PaymentID = " & Forms!frmPaymentsMyLineToo!PaymentID.Value
    Just wondering... What do you mean by "it errors out"? ...I ask because this SQL looks good to me... and I see that you're using the Form value... so questions come to mind...

    First... Remember that the form MUST be open when you try open this report... Otherwise you'll get NULL values in PaymentID

    Second... If by "it errors out" you mean that the report show #Error all over where the text values should be, that just means that there is no record to print (in my experience anyway)... ie No records where PaymentID = the Form's PaymentID...

    Just thought I'd mention it...

  8. #8
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: Gee Thanks

    Originally posted by Trudi
    Just wondering... What do you mean by "it errors out"? ...I ask because this SQL looks good to me... and I see that you're using the Form value... so questions come to mind...

    First... Remember that the form MUST be open when you try open this report... Otherwise you'll get NULL values in PaymentID

    Second... If by "it errors out" you mean that the report show #Error all over where the text values should be, that just means that there is no record to print (in my experience anyway)... ie No records where PaymentID = the Form's PaymentID...

    Just thought I'd mention it...
    Listen carefully what she is saying jmonroe because I saw that she solves a lot of problems on this forum. She is good.

  9. #9
    Join Date
    Dec 2002
    Posts
    117

    Thanks Guys

    It works someone but its not pulling in my data right now....Going to play with it for a bit.

    Thanks Trudi for your thought :-) At least you cared.

  10. #10
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Gee Thanks

    Originally posted by lodewijk
    Listen carefully what she is saying jmonroe because I saw that she solves a lot of problems on this forum. She is good.
    Awwwww... I'm blushing now... Thank you!

  11. #11
    Join Date
    Dec 2002
    Posts
    117

    Anytime

    You're welcome, darlin.

  12. #12
    Join Date
    Dec 2002
    Posts
    117

    Now This

    I have this coding on the Open command of the report

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE (((MyLineTooSupplierName) = Forms!frmPaymentsMyLineToo!MyLineTooSupplierName.V alue))"

    This command now prints out every record for that suppliername.

    Any help will be great.

  13. #13
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: Now This

    Originally posted by jmonroe
    I have this coding on the Open command of the report

    Me.RecordSource = "SELECT MyLineTooSupplierName, Date, PaymentType, PaymentAmount, PaymentDescription FROM tblPaymentsMyLineToo WHERE (((MyLineTooSupplierName) = Forms!frmPaymentsMyLineToo!MyLineTooSupplierName.V alue))"

    This command now prints out every record for that suppliername.

    Any help will be great.
    At least no errors but you wanted something with paymentID so replace supplier with payment
    (((PaymentID) = Forms!frmPaymentsMyLineToo!PaymentID.Value))"

    Does this works then your initial problem is solved?

  14. #14
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133

    Re: Now This

    For jmonroe :

    I'm afraid you're searching it all way to far!
    Simple solution :
    -insert a recordID in the table that contains the data for your form (if you don't already have one)
    -create a report that displays ALL the records
    -in the code for the printbutton on your form, call the report with the appropriate filter
    you might use this code :
    DoCmd.OpenReport "rptName", acViewNormal, , "[FieldNameID]=" & Me!txtID

    Pay attention to the following :
    -You must include the ID field in your reports recordsource
    -ID must be unique
    -the textbox txtID can be unvisible on your form but it must be there

    This works real fine and is simple.
    Try it

  15. #15
    Join Date
    Dec 2002
    Posts
    117

    Somewhat Works

    Hey Lodewijk

    The coding works.....however it prints all records that are listed under the particular supplier name.

    For example, I make a payment to Joes Computer Shop......then click print receipt.....when it prints....it prints out all records in the db for Joes Computer Shop.

    I am trying to get it to print the payment receipt for the specific record I enter the payment into.....

    So, I click make payment.....I select Supplier, Enter Date, Payment Type, Payment Amount, Payment Description, and click the print button.....I want to print out my rptReceiptPayment with only that payment on it.

    Thanks.

Posting Permissions

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