Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking a single cell on a form in a table

Status
Not open for further replies.
Jun 10, 2011
17
US
I have the follow example continous form

Row Name Color Age
1 Bob Blue 18
2 Tom Green 20
3 Dave Orange 25
4 Cindy Blue 17

The goal is to lock the age field just on row 3 because the color = orange Private Sub txtColor_AfterUpdate()

Age should still be editable for all other rows
 
You'll want to look at setting conditional formatting properties of the Age field with your criteria.

The use of continuous forms complicates what you're trying to do as any other code based solutions will want to enable/disable each row of Age, not just the row you're on.
 
I have exploered that avenue. Can't seem to get that option. Thanks for the suggestion though.
 
I would create a sub in the form like:
Code:
Function LockAge()
   'lock the age field just on row 3 because the color = orange 
    Me.Age.Locked = Me.Color = "Orange"
End Function
The set the after update event of the Color field and On Current of the form to
[tt]=LockAge()[/tt]

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top