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

    Print current record (Office 2000)

    Hello,
    I would like to make a command button print just the current record that I am viewing. Currently I have to do the file, print and select "selected record" to get it. Can I do the same thing with a button? If so, how?

    Thank you,
    Louise

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

    Re: Print current record (Office 2000)

    Try this line in the On Click event procedure of the command button:

    DoCmd.PrintOut PrintRange:=acSelection

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

    Re: Print current record (Office 2000)

    Hi Hans,
    It works perfectly! Thank you very much!
    Louise

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

    Re: Print current record (Office 2000)

    Hi Hans,
    I don't know what I did, but it no longer works, I keep getting an error message.

    "The expression On Click you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name."

    This is what is listed on the event procedure:

    Private Sub Print_Current_Form_Click()
    On Error GoTo Err_Print_Current_Form_Click


    DoCmd.PrintOut PrintRange:=acSelection

    Exit_Print_Current_Form_Click:
    Exit Sub

    Err_Print_Current_Form_Click:
    MsgBox Err.Description
    Resume Exit_Print_Current_Form_Click

    End Sub

    What did I do? How do I fix it?

    Thanks
    Louise

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

    Re: Print current record (Office 2000)

    It seems there is some kind of name conflict. Check carefully that you don't have another procedure with the same name.

    If you can't solve it, could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

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

    Re: Print current record (Office 2000)

    Hi Hans,

    I tried looking for duplicates yesterday but to be honest, I'm not sure I was looking in the right place.

    Attached is the very stripped down version. The print button in question is located on the form called "Employee Information Form - Print".

    Thanks again.
    Louise

  7. #7
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Print current record (Office 2000)

    Hi Louise

    I have deleted this code:


    Private Sub Form_Open()
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ID] = '" & Forms![form1]![ID] & "'"
    Me.Bookmark = rs.Bookmark

    End Sub

    and then created a new command button called PrintMe and then put this code behind the button:


    Private Sub PrintMe_Click()
    RunCommand acCmdSelectRecord
    DoCmd.PrintOut acSelection

    End Sub


    This seems to work now
    Jerry

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

    Re: Print current record (Office 2000)

    Thank you Jerry! That worked!

    I'm not sure where that code came from. Maybe when I was trying to go to this form from the "active" form. In any case, thanks!
    Louise

Posting Permissions

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