Cancel Message

H

Howard

When we click on a command button, a parameter box comes up "Enter last
name." If we click cancel, we get a Microsoft Access message, "The Open
Report action was canceled." Is there a way to suppress this message?

Thanks,
 
M

Mike Labosh

When we click on a command button, a parameter box comes up "Enter last
name." If we click cancel, we get a Microsoft Access message, "The Open
Report action was canceled." Is there a way to suppress this message?

When Access can't figure out what a control source points to, it displays
that parameter box expecting you to supply something. It sounds like you
may have an incorrect data binding on the report. If you have a text box on
the report that's supposed to display a last name, check its controlsource
property. It might just need some square brackets around the column name in
the control source. While you're at it, you might also check for something
similar in the query the report is based on.
--
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 ~~
 
H

Howard

Thanks for your reply.
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.

Thanks again,
Howard
 
M

Mike Labosh

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 ~~
 
H

Howard

Mike,
Thanks very much.
Peace to you!
Howard

Mike Labosh said:
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 ~~
 
Top