Macro using IF statement


Posted by Becky on February 13, 2002 7:22 AM

The project I am working on is a form that a user fills out, and then pushes a macro button which takes the info from the form, and adds it to a database & gives it a unique number.

This works perfectly.

The thing that I would like to add is a text box that stops the macro from running if a certain part of the form hasn't been filled in.
For example, the user pushes the button to add the information to the database, but the field "performance sector" is not filled in. I would like to have a box pop up that says "Please fill in performance sector and try again."

Thanks in advance for your help!
Becky



Posted by Jim on February 13, 2002 7:54 AM

Hi Becky,

Try this:

If Not IsNumeric(TextBox1) Then
MsgBox"You must first enter blah, blah, blah"
TextBox1 = ""
End If

Jim