Ralph,
Whenever you have trouble with code, cut and paste it exactly
as you have it, into your reply.
The syntax...
[SomeTextControlName].Locked = True
or
[SomeTextControlName].Locked = False
Is legitimate. I assumed that the code is called from an event on
the main form, and refers to a text control on the main form.
What types of controls are the other 2 controls.
What are they named, and what are the ControlSources
If they are bound, describe the bound field's properties from your
table design.
-------------------
the form is used for only one record at a time and
closed between accessing records...
There's no rule against that, but it would be more productive to have
a quick find combo box that would let you move from one record to
another during the editing process.
On my website (below), I have a sample 97 or 2003 sample file
called Combo Quick Find. It allows the user to edit a record, jump to
another record (by user combo selection)... edit that record.. etc..
etc...
Your call on that...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your
life."
Ralph said:
I get a compile error highlighting the '.Locked =' portion of the code :
"Method or data member not found"
I should say I am running Access 2007 if that matters.
What I find is that I can build the first .lock portion and can't just
paste
in the script. Then it works. But the next field doesn't give me the
'locked' choice. All I get is 'value' as a choice and if I type in
'locked'
then I get the error message again when I compile. All I am able to
lock
is
one field.
Private Sub Form_Open(Cancel As Integer)
If [Stratum] = 4 Then
ClaimsCount.Locked = False
UPmnt.Value
Else
ClaimsCount.Locked = True
UPmnt.Value
End If
Thank you. Because the form is used for only one record at a time and
closed between accessing records, the 'On Open' event would seem to me
to
be
okay to use. The form has tabs if that makes a difference
:
I want to lock several fields on a form using the 'On Open' event and
conditional locking that is dependent on the value in another field.
Something like,
If a field named 'Strata' is equal to "4" then lock three fields named
'ClaimsCount', 'Claims$', and 'ClaimsCorrect' so that data cannot be
entered
in them. The locked fields will be null values.
When the form closes I'd like to unlock the fields.
Thanks much,
Ralph