Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print Macro (A2K SR1)

    I have a form on which I have a Print Receipt button. The form, frmCheckInLast, displays the
    record which I want rptReceipt2 to use to print the receipt. The from has a unique field,
    [ReceiptNumber].

    I tried to create a mcrPrintReceiptLast. I was using an OpenReport action with the ReportName =
    rptReceipt2, the view = Print Preview (to give the operator a chance to review information before
    printing the receipt), and the WhereCondition is [ReceiptNumber] = [Forms]![frmCheckInLast]![ReceiptNumber]

    This results in the rptReceipt2 being displayed but no data is displayed.

    I am not sure about other actions that would be required or desirable.

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Check to see that the record has been saved before you print preview the report.
    If not, save it first.

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    I have other print button on other forms which I start with a Run command =
    Save Record. When I start this Macro that way, I get an error message The command "Save Record" isn't available now. I don't know what the problem could be.

    Tom

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Is this form based on one table? Is this a data entry form where the record was entered or a form on which the record is merely displayed? Is there anything else going on in this form?

    I'm less familiar with macros than code. If code is helpful to you, attach the following code to your print preview button to preview your report with the current record:
    <pre>Dim strDocName As String
    Dim strWhere As String

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    strDocName = "rptYourReport"
    strWhere = "[YourID]=" & me!YourID
    DoCmd.OpenReport strDocName, acPreview, , strWhere
    </pre>


    Post back with a few more details if this is not helpful.

  5. #5
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Get the same error message using your code.

    The form is based on a parameter query that displays the last rental record for a particular room.
    The room number is the input parameter. There is then a new record button that creates a new
    record. A number of the fields are filled in based on the information in the last record.

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Print Macro (A2K SR1)

    Could the problem be with the query itself? If you open the query, and try to enter a new row of data similar to what you would put in the form, does it let you?
    Regards
    John



  7. #7
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    The query may be creating a set that cannot be updated. Try John's suggestion and post back. Also what is the source of the report?

  8. #8
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    I have a parameter query, qryRentCalcLast that requests the operator to enter a room number. In
    order to get the latest record for that room number, I sorted the [CheckOutDate3] field in
    Descending order and set the TopValues property to 1.

    If you open the qryCalcLast, it will not allow you to add a new row of data. When you use the
    NewRecord button, it populates the new form including the [ReceiptNumber] (key Field). The
    form also has a SaveRecord button which saves the record. You can then use a frmCheckInEdit
    which allows you to call up a record by receipt number. At this point, you can print the receipt.

    FrmCheckInLast uses qryRentCalcLast. When the form is called the operator enters the room
    number which displays the latest record for that room number. If the operator wants to extend the
    guest, the NewRecord button is pressed. The NewRecord button has the OnClick event set to
    mcrNewRecordLast.

    McrNewRecordLast has a GoToRecord action with the Record = New. It also has a
    GoToControl with the ContronName = PayID.

    The qryRentCalcLast is based on 3 tables: tblRental, tblPropertyName and qryCustomerSorted
    (tblCustomer sorted by [LastName], [FirstName], and [MiddleInitial])

  9. #9
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

     I have been experimenting with my mcrSaveRecordLast which was not working properly. If I
    close the frmCheckInLast, it saves the record. The Save action appears to save the form but not
    the record. By adding an open form action, it now calls up the record which was just saved (it is
    now the last record). When it opens the form the operator must again enter the room number.
    Once this is done, the print receipt button works. Is there a code option that would close the
    form (to save the record), open the form again and supply the room number so the operator
    doesn

  10. #10
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Print Macro (A2K SR1)

    There is a macro command: RunCommand which allows you to choose SaveRecord as the command to run.
    try that.
    Regards
    John



  11. #11
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    The Save Record command is not available. See previous thread.
    Thanks for the suggestion. I now know the difference between the Save and Save Record command.

    Tom

  12. #12
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Well, there might be Tom, but this just doesn't seem right to me. If you can't add a record in the query that your form is based on, that is a problem. How about having the Add Record button open a form that is based on a Record Source that you can add records to? If this is still causing you problems, can you post a small db, so that we can take a look at it?

  13. #13
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    I have pared down the database. It has 10 records in tblRental. The room numbers are 102, 104, 107, 111, 113, 115, 201, 203, 208, and 213. The pared file is 246KB. Can I E-mail it directly?

    Tom

  14. #14
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Sure

  15. #15
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print Macro (A2K SR1)

    Please sent E-mail address to tdays@infi.net

Page 1 of 3 123 LastLast

Posting Permissions

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