Enable/Disable fields on records

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

Guest

im displaying multiple records in a form. i dont want them to enter the
details until a checkbox has been checked for that record.

how do i do that?
 
You could do it one of two ways.

1. you could lock the entire form
Or
2 you could lock the fields individually

2 is easier if you don't have too many fields.

Use the OnCurrent event for the form to run code that locks the fields if
the user hasn't checked a box.

In OnCurrent in the property window click the ... syymbol to access the
Visual Basic.

Code will read something lkike this

If Me![MyCheckBox]=Yes Then
Me![ContactName].locked = False
Me![ContactAddress].locked = False
Else
Me![ContactName].locked = True
Me![ContactAddress].locked = True
End If

That will lock or unlock fields as the record becomes the current record.

You also need to remenber to lock or unlock these fields after the user
checks/unchecks the box. To do this use the AfterUpdate event for the check
box and copy in the same code.

You could create a Private function and call the same function from both
places but that's another post
 
Back
Top