How to catch "Action Failed" macro error so that the Halt dlg doesn't show

F

FrankBooth

Hi,

I have a Find macro that uses an InputBox (not Application.InputBox)
as the parameter. When I click Cancel to the inputbox I receive the
"Action FAiled" HALT dialog. I do not want this to come up, I just
want it to go back to the main app.

How do I catch this error?

Thanks in advance.

--FB
 
K

Ken Snell

Test the value returned by the InputBox for an empty string (""). If it is
an empty string, then have your macro end and go back to where you want to
go.
 
Joined
Jun 21, 2007
Messages
2
Reaction score
0
I'd try it with code.

In the OnClick property line, right click to get the
Build... option and select EventProcedure. When the VB
window opens, use this code:


Private Sub Command1_Click()
On Error GoTo Err_Command0_Click
DoCmd.OpenQuery "qry_MyQuery", acViewNormal
Err_Command0_Click:
Exit Sub


End Sub
 

Ask a Question

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.

Ask a Question

Top