Locked=True Fuzzy

SteelersFan

Registered User.
Local time
Today, 02:56
Joined
Feb 9, 2005
Messages
38
I have a form that has code tied to the 'on open' event that is going to be accessed by users where we want them to only have access to certain fields which we want them to fill out. The fileds that will be locked will change based on the field called 'Item Number'. The code will be long because there are 30 different Item Numbers and about 10 to 20 fields that we will disable based on the Item Number. The code is like:

Dim Item_Number As String
If Me.Item_Number = "32000" Then
Me.Batch_Lot_Number.Enabled = False
End If

This is all great except that the disable makes the field kind of obscure by the color it gives it. I don't want to use the lock property because that doesn't give you a visual clue that its locked.

Is there a way to change the color of the field background using VBA?
 
How about just making them vanish and reappear using the .visible command?
 
Not bad..

Except I want them there for their information.

Dave
 
I prefer for the unlocked fields to have a white background and the locked fields to be transparent [same color as the form for I use grey forms]. Visually it is easy for the user to see what fields they can edit. The back color I use for my forms is -2147483633 [yes that is a negative].

Code:
Me.YourTextBoxName.BackStyle = 0 [COLOR=Green]'0 = Transparent, 1 = Normal[/COLOR]
 
The Open event only fires when the form is opened. So if you allow scrolling in the form, only the first record will be properly set. You should move the code to the Current event.

Why are you Dim'ing controls? Get rid of the Dim statements. Also, if Item_Number is numeric, remove the quotes. Only strings should be enclosed in quotes.
 

Users who are viewing this thread

Back
Top Bottom