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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Field Read Only 2

Status
Not open for further replies.

kcbeckwith

Technical User
Sep 2, 2004
12
US
I have a field called ReasonforRelease that is a text field with a value list of Death, Released, Transferred. My question is how would I make that field "Read Only" if released or transferred were chosen. I would like to also be able to change the color of that field when it becomes Read Only. I'm trying to create an archive without removing the data by making it inactive.
 
In the forms OnCurrent event, you could say:

If Me.txtReasonforRelease = "Released" Or _
Me.txtReasonforRelease = "Transferred" Then
Me.txtReasonforRelease.Enabled = False
Else
Me.txtReasonforRelease.Enabled = True
End If

Repeat the code in the AfterUpdate event of txtReasonforRelease.

-Gary
 
How about something like this in the OnCurrent event of the form....

Select Case Me.txtReasonForRelease
Case = "Released", "Transferred":
Me.txtReasonForRelease.Locked = True
Me.txtReasonForRelease.Forecolor = vbBlue
Me.txtReasonForRelease.Backcolor = vbYellow
Case Else:
Me.txtReasonForRelease.Locked = False
Me.txtReasonForRelease.Forecolor = vbBlack
Me.txtReasonForRelease.Backcolor = vbWhite
End Select


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top