Link to home
Start Free TrialLog in
Avatar of sml41
sml41

asked on

report

I use VB6 to print a report directly from access 97,. it works ok to print, but if i choose cancel button in the dialog box (parameter query box to enter date or id...etc) this produces a run time error 2501 and then exits
the program.  how can i solve this please from BV6.
Avatar of mark2150
mark2150

You need to have the CancelError set to true and an ON ERROR statement in your code to run when [Cancel] is true. This is correct operation for this control.

M
Avatar of sml41

ASKER

hi,
this is my code, i experemented as u suggested, i could not succeed, can u tell me where i check for the error please in my code.

thanks
Private Sub bookingBetweenTwodates_Click()
Set Access = GetObject(App.Path & "\MyDb.mdb")
Access.DoCmd.OpenReport ("MyAccessReport")

Set Access = Nothing

End Sub
ASKER CERTIFIED SOLUTION
Avatar of mark2150
mark2150

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sml41

ASKER

thanks I visited your website, it's cool.
Glad you liked it. Did you have your speakers on when you visited? :-)

M
Avatar of sml41

ASKER

yes i did, & i agree with you