how to disable to text box

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

Guest

dears

I have a text box which captures the age with weeks e.g. 2 yrs 10 weeks.
If the age goes below or above a certain age limit it should disable other
text boxes in the form

can it be done, if so how?
any help will be appreciated
thanks
 
After you capture the age and weeks put the following code in the
afterupdate event of the text box that captures the age etc.

assume person_age is the text box to capture the age.
age_limit determines above or below

sub person_age_afterupdate()
if me!person_age = me!age_limit then
' now unlock the required fields
me!field1.locked=false
' enter the remaining fields
me!fieldx.locked=false
else ' age is above or below
' now ensure the required fields are locked
me!field1.locked=true
' enter the remaining fields
me!fieldx.locked=true
end if

end sub

Allan Murphy
Email: (e-mail address removed)
 
Typically, you would save the birthdate, not the age. Age will be different
tomorrow and your data will be wrong. Why not capture the birthdate and
then calculate the age?
 
Dear Allan,

u r very close, though I havea question
after entering the date of birth in the date field, the age and weeks is
captured in the person_age field.

how will age_limit field determine above or below criteria.. as of now I
created a age_limit field but cannot populate the result in it

ideally the way I need is e.g. age is 5 years and 0 weeks or less should be
OK or else rejected (other field should disable)

Thanks
 
Back
Top