My Assistant
![]() ![]() |
|
|
Dec 8 2011, 09:52 AM
Post
#1
|
|
|
UtterAccess Veteran Posts: 380 From: Minnesota |
Hi,
I have a "Submit" button on a form that contains required fields. The "Submit" button currently closes the form and requery's the form that the closed form was launched from. As it is currently, if I do not complete all required fields and click submit, it pops the error message about missing a required field, then a message prompting to close the form or not, then a macro failed message. Obviously not a good user experience, so just wondering if I can use macros to alter this behavior or if VBA would be required. I prefer macro, but either way, need some guidance. Ideally, I would like the form to just pop once message stating that a required field was missed, with two buttons - one returns the user to the form to correct, the other closes the form without saving changes, and neither option would pop any further errors or failed macro windows. Thanks, Bill |
|
|
|
Dec 8 2011, 10:44 AM
Post
#2
|
|
|
Access Wiki and Forums Moderator Posts: 48,564 From: SoCal, USA |
Hi Bill,
What version of Access are you using? Knowing the Access version may help us determine a more appropriate response to your question. You should be able to modify the code you have running behind your Submit button to check for required fields first before proceeding with the steps to close the form. For that button, are you using a macro or VBA? Is this form bound or unbound? |
|
|
|
Dec 8 2011, 10:52 AM
Post
#3
|
|
|
UtterAccess Veteran Posts: 380 From: Minnesota |
Sorry - added to my signature so I don't forget in the future - Access 2007
Currently it's a macro, bound form. The on-click event is Close (Save=yes). |
|
|
|
Dec 8 2011, 11:08 AM
Post
#4
|
|
|
Access Wiki and Forums Moderator Posts: 48,564 From: SoCal, USA |
Sorry - added to my signature so I don't forget in the future - Access 2007 Thank you. QUOTE Currently it's a macro, bound form. The on-click event is Close (Save=yes). Then you should be able to add a Condition column to your macro to check if the required fields are empty or not and proceed with the form close appropriately. For example, you might try something like: Condition: Len(Forms!FormName.ControlName & "") = 0 Action: RunCommand, Undo (untested) Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
Dec 8 2011, 11:24 AM
Post
#5
|
|
|
UtterAccess Veteran Posts: 380 From: Minnesota |
Perfect - here's what I landed with (attached).
Thanks!
Attached File(s)
|
|
|
|
Dec 8 2011, 12:19 PM
Post
#6
|
|
|
Access Wiki and Forums Moderator Posts: 48,564 From: SoCal, USA |
Hi Bill,
Congratulations! Good luck with your project. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th June 2013 - 02:12 AM |