Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing record from form (office 2000)

    Hello, I have a control button on a form that prints the current record. It works fine but I was wondering how I could get it to print without the "picture" background of the form. It's not really a picture, it's just one of Office's backgrounds.

    When I print a record, the record is only about half, or a little over, the sheet of paper it's printed on and the rest of the print is the background. Perhaps there's a way that I can "tell" it not to print beyond the record? In other words, leave the bottom of the page unprinted or white? Margins?

    Just thought I'd see if anything could be done without changing the form itself.

    Thanks,
    Louise

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing record from form (office 2000)

    Forms aren't really meant for printing. I never use them for that purpose. I would create a report based on the same table or query as the form instead, and place a command button on the form to open the report for the current record. The On Click event procedure for the command button would look like this:

    Private Sub cmdReport_Click()
    DoCmd.OpenReport "rptMyReport", acViewPreview, , "[ID]=" & Me.[ID]
    End Sub

    where cmdReport is the name of the command button, rptMyReport is the name of the report, and ID is the name of a field that uniquely identifies the record (for instance an AutoNumber field).
    I have assumed that ID is a number field, if it is a text field, use

    ..., , "[ID]=" & Chr(34) & Me.[ID] & Chr(34)

    Chr(34) is the double quote character ".
    If you want to print directly instead of previewing the report, change acViewPreview to acViewNormal.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Printing record from form (office 2000)

    Like Hans, I never "print" a form. I essentially use the same techique he explained. The only other thing I do is to save the current record on the form (if it is dirty) before running the report.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing record from form (office 2000)

    Good point, thanks for the addition!

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing record from form (office 2000)

    Thank you both very much for the tips! Great idea! I never thought of doing that.

    Thanks once again,
    Louise

  6. #6
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing record from form (office 2000)

    Hi Mark.
    I've never heard the expression "dirty" used in Access. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Should I assume that you mean a record that has just been entered and perhaps not saved by Access yet?

    Thank you very much,
    Louise

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Printing record from form (office 2000)

    A record is 'dirty' if any of its field has been edited and the record hasn't been saved; this can happen with an entirely new record that has just been created, or with an existing record that is being modified.
    A form actually has a property Dirty that starts out False, but is set to True the user changes a value, and is set to False again when the record is saved. So in the code behind the command button, you can insert code like this above the line that opens the report:

    If Me.Dirty Then
    RunCommand acCmdSaveRecord
    End If

    (In the code behind a form, Me refers to the form itself.)

  8. #8
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing record from form (office 2000)

    Hi Hans,

    Goodness gracious! What don't you guys know? <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30> Thanks for the info!

    Have a good day!
    Louise

  9. #9
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Pontiac, Michigan, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing record from form (office 2000)

    I regularly print just one record from the screen. I use File|Print|Selected Record. I don't get any extraneous background using that method and I do get ALL the info on subforms even if they aren't visible on the screen. Works for what I want.

Posting Permissions

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