VBA set Textbox to be required (1 Viewer)

Rania01

Member
Local time
Today, 15:57
Joined
Oct 9, 2021
Messages
59
Dear all,

How to programatically set Textbox to be required?
If value on Status on the textbox Datum must be required

Thank you in advance
photos.jpg
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:57
Joined
Oct 29, 2018
Messages
21,457
Is the form bound? If so, it might be easier to just set the field in the table as required. Otherwise, the common approach is to use the form's BeforeUpdate event to validate the form and make sure required fields are entered.
 

Rania01

Member
Local time
Today, 15:57
Joined
Oct 9, 2021
Messages
59
I use textbox unbound, I would like only the Datum must be required if user select value on Status
if on status is empty on the datum not required

Thank you
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:57
Joined
Sep 21, 2011
Messages
14,238
I use textbox unbound, I would like only the Datum must be required if user select value on Status
if on status is empty on the datum not required

Thank you
Wouldn't it make more sense to have the status first then?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:57
Joined
Feb 19, 2002
Messages
43,233
I agree with Gasman, resequencing the controls makes more sense. You can even hide/show the optional field if that would be useful. BUT as the others have already mentioned, the form's BeforeUpdate event is where the validation must go.

If you are using unbound forms, you are not using Access to your best advantage and should probably be using a different development platform.
 

Users who are viewing this thread

Top Bottom