Beforeupdate: Using a function instead of an event procedure

B

bdtmike

I have a form with a lot of text boxes (120 of them). Rather than
create 120 Beforeupdate event subs, I want to have all the text boxes
call a single function which will do the validation.

I set the Beforeupdate property to this function ( e.g.
=TestData() ). The function is called correctly but Access ignores
the return value and validation always "passes". I need my function
to return False and access will cancel the event. Is this even
possible?
 
A

Allen Browne

When you call the function that way, you do not pass the Cancel argument. So
if the function is not happy with the results, it will need to run this
line:
DoCmd.CancelEvent
 
B

bdtmike

When you call the function that way, you do not pass the Cancel argument. So
if the function is not happy with the results, it will need to run this
line:
DoCmd.CancelEvent

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.







- Show quoted text -

Thanks, Allen. Works like a champ
 

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