Lock only updated record

  • Thread starter Thread starter Linda RQ
  • Start date Start date
L

Linda RQ

Hi Everyone,

Using Access 2003. I have a patient database. I will try to explain as
best I can but I don't know the object names etc very well so let me know
what else I need to give if the info makes no sense. I have a subform of
patient therapy that shows on a main form. There are several fields with
therapy detail on my subform that get filled out when a therapy is started.
When the therapy is ended, the end date field is filled in. I need to lock
one field (therapy type) once a therapy is selected. The therapy type field
is a combobox with a list to select from. I tried going into the form
properties and locking the record and not allowing edits but then I couldn't
enter an end date later. I tried going into the control for therapy type
and locking that which worked but then I coudn't add therapy type to a new
record.

Is there anyway without vb code that I can prevent the user from changing
just that item once it has been entered?

Thanks,
Linda
 
Linda -

Try something like this in the OnCurrent event for the form (use your
control name for cboName):

If me.cboName.column(0) is null then
Me.cboName.enabled = True
Else
Me.cboName.enabled = False
End If
 
Thanks Daryl...but I said no VB code puleeze...but ok, I'll try <g>. I can
sort of see what that is saying. This is what I did. I clicked in the
corner of the subform in the design view of the form and pulled up the
properties. I clicked in the OnCurrent event and went into build and pasted
your code. I compiled then saved. When I opened up the form in form view I
got a debug error and the second line below "If Me.ThpyTypeID_fk.Column(0)
Is Null Then" is highlighted in yellow.

Private Sub Form_Current()
If Me.ThpyTypeID_fk.Column(0) Is Null Then
Me.ThpyTypeID_fk.Enabled = True
Else
Me.ThpyTypeID_fk.Enabled = False
End If
End Sub
 
Hi Linda,

The syntax is wrong; the line should be:
....
If IsNull(Me.ThpyTypeID_fk.Column(0)) Then
....

HTH,

Rob
 
Back
Top