Beforeupdate: Using a function instead of an event procedure

  • Thread starter Thread starter bdtmike
  • Start date Start date
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?
 
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
 
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
 
Back
Top