Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Posts
    42

    Unanswered: Printing a form...

    Hi,

    I have set up a DB for a car hire company and I have now completed it. I have made a report called, 'Invoice' and when the user is on a form called 'Rents', I want the Invoice report to be printed with the specific records on the screen. However, I don't want a print button - I want the specific record to be printed when the user saves the record - i.e. the invoice is printed automatically.

    Does anyone know how to achieve this?

  2. #2
    Join Date
    Dec 2003
    Posts
    1
    DoCmd.OpenReport stDocName, acViewNormal

    using the following command automatically sends the report for printing.

    Hope it helps

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    You could try this....Place this code into your Rent Form's BeforeUpdate event:

    Code:
    If WhateverCondition = True Then
       DoCmd.OpenReport "Invoice"
       DoEvents
    End If
    When the user moves to a new record, your invoice is automaticaly printed. You will of course want to put a condition into place to ensure that there is infact data to print in the invoice.

    Hope this helps

  4. #4
    Join Date
    Dec 2003
    Posts
    42
    Hi thanks for the help.

    I've used that code, but the problem is it prints out every single record in the Rents form, rather than just the one currently displayed on the screen.

    Is there a way around this?

  5. #5
    Join Date
    Dec 2003
    Posts
    42
    Is there a way to pass a TransactionID into the report, so that it only prints off that specific set of records?

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    Try something like this:

    Code:
    If WhateverCondition = True Then
       DoCmd.OpenReport "Invoice", , , "[TableTransactionIDFieldName] = '" & Me.TransactionIDFieldNameOnMyForm & "'"
       DoEvents
    End If

Posting Permissions

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