I didn't explain myself very well. When we click on the command button a
parameter box pops up (Like expression in the query) asking the user to enter
her or his last name. If OK is clicked only her or his records in the report
are displayed. If Cancel is clicked, a Microsoft Access message box pops-up
"The OpenReport action was canceled." It's this message we want to
suppress.
Ahh.
Whatever calls OpenReport could probably be cleaned up with some error
handling [air code]:
Private Sub btnReport_Click()
On Error Resume Next
DoCmd.OpenReport "my report"
End Sub
This way, if the user clicks the cancel button, the error condition is
absorbed into a black hole and the user can continue doing something else
without Access getting mad at them.
One other thing you might consider, is that if you're on a network, Windows
knows who is sitting at the keyboard once they've logged in. You could
programmatically get the Windows username from the GetUsername API function
and then pass that as a parameter to the report so the user doesn't even get
the initial parameter dialog.
--
Peace & happy computing,
Mike Labosh, MCSD
"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS!"
~~ General Barringer ~~