E
EDee
Is it possible to have the access report wizard launch via a command button
on the switchboard??
thanks for the Help!!
on the switchboard??
thanks for the Help!!
Is it possible to have the access report wizard launch via a command button
on the switchboard??
thanks for the Help!!
Could you walk me through actually using that code? I'm assuming it needs to
become a module but i'm not sure how to even do that.
thanks again, i'm a total newbie
EDee
fredg said:Could you walk me through actually using that code? I'm assuming it needs to
become a module but i'm not sure how to even do that.
thanks again, i'm a total newbie
EDee
Asuming you are NOT using the switchboard created by the built-in
Access Switchboard Manager, add a command button to your Switchboard
(without using the Tool Box Wizard .. the Wand with stars should be
up).
Display the button's property sheet.
Select the Event tab.
On the Click event line, type:
[Event Procedure]
Then click on the little button with 3 dots that appears on that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines, write:
DoCmd.RunCommand acCmdNewObjectReport
Save the code by exiting the window.
When you open the form and click on the command button, the New Report
wizard will appear.
If you are using that built-in switchboard (with the 8 buttons), you
will need to do this differently.
Create a new module:
Sub OpenWizard()
DoCmd.RunCommand acCmdNewObjectReport
End Sub
Save the module.
Then using the switchboard manager, set one of the 8 buttons to
Run Code.
Write:
OpenWizard
in the Function Name box.
Save all the changes.
*** snipped ****Perfect. thanks, it worked. I'm using the built in switchboard and now it
launches the wizard but when the wizard is closed or completed error message
"runtime error '2501' The Run Command action was cancelled" appears.
How do i get rid of that?
fredg said:*** snipped ****
That is a VERY common error.
Every time you open a form/report via code and then cancel Access will
generate Error 2501. You need to trap that error in the Sub or
Function error handling that runs the code.
The Switchboard code already has code to trap error 2501 in the
HandleButtonClick_Err: error handler, however you are not opening the
wizard from the code on the switchboard but from the code in the
module.
Change the code in the module to:
Sub OpenWizard()
On Error GoTo Err_Handler
DoCmd.RunCommand acCmdNewObjectReport
Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
End If
That should be all you need do.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.