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:
Private Sub Command1_Click()
It is here you need to enter your code (of course, Command1 will be the name of your command button). For example:
Private Sub myCommandButtonName_Click()
DoCmd.OpenReport "Report Name" , acViewNormal, , "[PrimaryID] = " & Me.PrimaryID
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.