KEEP FORM OPEN IF A FIELD IS BLANK

D

DEBRA

I WANT TO CREATE A MACRO OR VALIDATION OR MODULE THAT WOULD NOT ALLOW A FORM
TO CLOSE IF A CERTAIN DATA FIELD WAS LEFT BLANK. I CAN SET VALIDATION RULES
BUT I AM STUMPED ON HOW TO KEEP SOMEONE FROM ENTERING FURTHER INTO THE
DATABASE UNLESS THEY SIGN IN PROPERLY.
 
M

MikeJohnB

If I was trying to do this, this is how I would get to the same place you
want to be. Make the form popup or maximised and modal, this will stop the
user from clicking anywhere else to move focus from the current form. Turn
off all the forms close controls in the forms properties. Now you have a form
you can open but not close.

To close the form. Add a close button. Use the wizard to generate a button
to close the current form (DoCmd.Close (lookup the syntax in help for your
access version))

In the forms on open event, disable the close button (Me.ButtonName.Enabled
= False)

In the Control that is not to be Null, After Update event re-enable the
button (Me.ButtonName.Enabled = true) (You may have to play with which event
of the Control carries the Enable code)

I hope I have explained carefully and that this solution helps you.

Kindest Regards

Mike
 
D

DEBRA

Thank you. I am going to attempt this.

MikeJohnB said:
If I was trying to do this, this is how I would get to the same place you
want to be. Make the form popup or maximised and modal, this will stop the
user from clicking anywhere else to move focus from the current form. Turn
off all the forms close controls in the forms properties. Now you have a form
you can open but not close.

To close the form. Add a close button. Use the wizard to generate a button
to close the current form (DoCmd.Close (lookup the syntax in help for your
access version))

In the forms on open event, disable the close button (Me.ButtonName.Enabled
= False)

In the Control that is not to be Null, After Update event re-enable the
button (Me.ButtonName.Enabled = true) (You may have to play with which event
of the Control carries the Enable code)

I hope I have explained carefully and that this solution helps you.

Kindest Regards

Mike
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B
 
M

MikeJohnB

Thanks for the response Debra, if I can assist further, re-post here.

Regards

Mike
 
M

MikeJohnB

One thing I forgot to mention is the fact that you will have to test for
valid entry of text in the Control. I have not included any code but you may
have to do a lookup to a password and user table, if valid then enable the
Control.

Hope this helps
 

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