Textbox Validation - only allowed a date + BeforeUpdate

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
All,

I'm trying to get the correct syntax to Validate a Textbox.
I'm trying to use BeforeUpdate bet can't figure out the how.

Rules:

Person must enter a Date:
>=#09-11-04# and <=Date()

The problem I have is that I need to run some code to update 3 other Fields on the form, If the above is true.

BUT! how do I stop someone entering 'Ian' or % or whatever and trap it
It seems that the 'Short Date' format validation kicks in before the BeforeUpdate event. Or stops it, or something.

I'm a little confused and could do with some help,
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Ian, I think you can do this using the BeforeUpdate event of the FORM, not the textbox. That way, the user can put the crummy data in but can't go to the next record without fixing it. [You can also enter code to set focus on the offending textbox]. In the same event code, you can update the other fields too.

Does that help?

Denis
 
Upvote 0

Forum statistics

Threads
1,221,837
Messages
6,162,282
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top