Set Required property for field based on the entry in other field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to set the Required method of a memo field based upon the entry in the
previous field. Normally, the field is not required, but if the entry in the
previous field falls below 0.5 or above 5.0, then an explanation in the memo
field is necessary.

According to the Help, the Required property is enforced at the table level,
but is there any way you can use code to change it based on criteria.

Thanks for your help as this is my first database!
 
You can enable/disable the memo field on the form based on the criteria
of the field that identifies below 0.5 or > 5.0. Is this value entered
by the user? If so you can use the following in the After Update of
the value entry field:


example_AfterUpdate()

If txtExample < 0.5 or > 5.0 Then
me.memofieldname.Enabled = True
Else
me.memonamefield.enabled = False
End if

You may need to do some slight modifying based on the data types of
these fields, but this should be a starting point .

Thanks!
 
The memo field should be available for use at all times, but must be used if
the criteria in the previous field is not met. Therefore, enabled won't work
for my needs. How can I keep them from leaving the current record without
completing it if the criteria is not met?
 
Back
Top