Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2001
    Location
    Stuttgart, Germany
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Custom toolbar in report (A2K SR1)

    Hi,

    I have a database handling courses and students. There are lots of lists just needing to be printed out (no export etc.) implemented as reports. I would like to assign those reports custom toolbars/menu bars (Charlotte, thanx for the hint!) containing only the (hopefully) harmless commands. (Yes, I now too what users are able to, idiot or not :-))) ). The point is, I can't find all the commands in the list if I open the Customize dialogue.

    It's the commands "1 page", "2 pages" etc. and a print command which brings up the normal printer dialogue I'm looking for. Users may want to print some lists in >1 specimens, or may want to choose economode or something. The only Print command I found is the shortcut for direct printing.

    And please, please don't tell me I have to do all this via VBA - the deadline is already falling upon me like the dark shadow of Dracula ...

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar in report (A2K SR1)

    I know the SendKeys function is somewhat frowned upon, but I've successfully used Ctrl+P (^p) in a macro, then assigned the toolbar button to the macro.

  3. #3
    Lounger
    Join Date
    Apr 2001
    Location
    Stuttgart, Germany
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Custom toolbar in report (A2K SR1)

    Hi Mark,

    thank you for replying. Yes, it would be so simple - only it didn't work. I don't know why, if I pressed ctrl+P, the printer dialogue came up all right, but clicking the custom command bar button just didn't do anything. No dialogue, no error, nothing. After trying around, I turned back to VBA and ended up with this code (this was a hint in ADH in the discussion about command bars):

    <pre>Public Function PrintDialogue()

    On Error GoTo ErrPrintDialogue


    DoCmd.RunCommand acCmdPrint


    ExitPrintDialogue:
    On Error Resume Next
    Exit Function


    ErrPrintDialogue:
    Select Case Err.Number
    Case ERR_CANCEL_COMMAND 'Constant for command cancelled error 2501
    'User klicked Cancel, do nothing
    Case Else
    MsgBox CStr(Err.Number) & ": " & Err.Description, vbCritical+vbOKOnly, "Error in PrintDialogue"
    End Select
    Resume ExitPrintDialogue

    End Function
    </pre>

    Put that in a macro (executeCode), assigned the macro to the button and it works. I also have buttons for 1, 2, 4 pages preview.

Posting Permissions

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