Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    19

    Unanswered: Please Help Can't Print Single Record from Form

    When I place the command

    DoCmd.OpenReport "Report Name" , acViewNormal, , "[PrimaryID] = " & Me.PrimaryID

    in the on click line of a command button on my form

    It gives me an error

    Microsoft Access can not find the macro "DoCmd"

  2. #2
    Join Date
    Feb 2004
    Location
    Canada
    Posts
    133

    Re: Please Help Can't Print Single Record from Form

    Did you try my suggestion?
    http://www.dbforums.com/t989553.html

  3. #3
    Join Date
    Mar 2004
    Posts
    19

    Re: Please Help Can't Print Single Record from Form

    Originally posted by bmacr
    Did you try my suggestion?
    http://www.dbforums.com/t989553.html
    Yes and still the same thing

    Microsoft Access can not find macro "DoCmd"

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    You have obviously done something wrong. Make sure the following is TRUE:

    There is nothing OTHER THAN [Event Procedure] written in the box located beside the On Click event (in the properties window) for your Command Button. If anything other than [Event Procedure] is located there then delete it.

    If the field box located beside the On Click event name is empty, then double-click on it. The words [Event Procedure] will automatically be placed there.

    Now, to the far right side of the On Click event field, you can see a small box with 3 dots in it. Click on this small box. A VBA edit code window will open up and the flashing editing carrett will already be located within the On Click sub routine....for example:
    Code:
    Private Sub Command1_Click()
    |
    End Sub
    It is here you need to enter your code (of course, Command1 will be the name of your command button). For example:
    Code:
    Private Sub myCommandButtonName_Click()
       DoCmd.OpenReport "Report Name" , acViewNormal, , "[PrimaryID] = " & Me.PrimaryID
    End Sub
    That should do it for you.

    Last edited by CyberLynx; 03-21-04 at 02:56.

  5. #5
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    what did you program on the "on click" event ?

    emiel

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    Nothing...take a look at the sample I've provided. Dont bother to click the button...it will generate a error. It is simply provided to show you how to place code for your command button(s), or other controls.
    Attached Files Attached Files

Posting Permissions

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