Error Message

  • Thread starter Kyle Friesen via AccessMonster.com
  • Start date
K

Kyle Friesen via AccessMonster.com

Hello,
I have a command button on a form that is linked to a macro that runs queries, saves the data to the form's table, etc. The table has required input fields and so when the command button is selected without all fields entered an "Action Failed" error message appears with "Halt", Macro could not be executed, etc. I have code that scans the required fields on the form through the before_update module. Question: How do I get rid of the Halt "Action Failed" error message so that my MsgBoxes are the only error messages that appear?? It seems I have two different error messages for the same error. Thanks.
 
K

Ken Snell [MVP]

In order to do what you seek, you'd need to validate that all required
values have been entered. If you wish to do this within that macro, you'd
need to add 2 steps as the first steps in the macro that has a condition to
check that all values have been entered:

Condition: IsNull(Forms!Formname!Controlname1) Or
IsNull(Forms!Formname!Controlname2) Or IsNull(Forms!Formname!Controlname3)
Action: MsgBox
Message: You need to provide values for all fields!

Condition: . . .
Action: StopMacro
 
K

Kyle Friesen via AccessMonster.com

thanks. can you point me in teh right direction as to where I put these conditions...thanks, I am just learning.
 
K

Ken Snell [MVP]

When you open the macro in design view, if you don't see a column named
Condition, then click on View menu and select Condition from the list. Type
the expression that I provided into that box.

Note that the second line has three dots in it. Type them into the Condition
box for the second line:
...

This is how you have multiple steps be run for a single Condition... the
three dots are a continuation.
 

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