Hi there. Using A02 on XP. Have a DepositForm and want to
have the field [DateDep] lock after data entry. (Edits are
allowed on a separate Supervisor form.) I have tried to
put the following in a variety of event procedures but
having trouble locking it down.
I put this in the OnGotFocus and it works initially but
after you click okay to the message, you can edit the
field. Ugh!
If Not IsNull(Me.DateDep) Then
MsgBox "This field has already been filled."
DoCmd.CancelEvent
Exit Sub
End If
Should I replace CancelEvent with Me.DateDep.Enabled=False?
Problem is that my form is a continuous form showing all
the checks received that day for processing. Don't want to
disable [DateDep] for the other records until they have
also been keyed in.
Thanks in advance for any and all help or advice!!!
Rob Oldfield - 22 Mar 2005 19:47 GMT
Try this in the current event of the form...
Dim Lck As Boolean
Lck = Not IsNull(Me.DateDep)
Me.DateDep.Enabled = Not Lck
Me.DateDep.Locked = Lck
> Hi there. Using A02 on XP. Have a DepositForm and want to
> have the field [DateDep] lock after data entry. (Edits are
[quoted text clipped - 20 lines]
>
> Thanks in advance for any and all help or advice!!!
Bonnie - 23 Mar 2005 15:17 GMT
Thanks for the info!!!
>-----Original Message-----
>Try this in the current event of the form...
[quoted text clipped - 30 lines]
>
>.
Scott McDaniel - 22 Mar 2005 19:52 GMT
Why not simply Lock the field in the Form's Current event? Even with
continuous forms, this would function. So you'd do something like this:
Sub Form_Current()
Me.DateDep.Locked = (Nz(Me.DateDep,0) <> 0)
End Sub
> Hi there. Using A02 on XP. Have a DepositForm and want to
> have the field [DateDep] lock after data entry. (Edits are
[quoted text clipped - 20 lines]
>
> Thanks in advance for any and all help or advice!!!
Bonnie - 23 Mar 2005 14:59 GMT
Exactly what I was asking how to do and exactly what you
answered so I'm a happy camper and grateful for your input.
Thx!
>-----Original Message-----
>Why not simply Lock the field in the Form's Current event? Even with
[quoted text clipped - 29 lines]
>
>.
Marshall Barton - 23 Mar 2005 00:01 GMT
>Hi there. Using A02 on XP. Have a DepositForm and want to
>have the field [DateDep] lock after data entry. (Edits are
[quoted text clipped - 18 lines]
>disable [DateDep] for the other records until they have
>also been keyed in.
Normally, this kind of thing is done by setting the
cantrol's Loacked property in the form's Current event.
Me.DateDep.Locked = Not IsNull(Me.DateDep)
Since it's a continuous form, this will lock the text box
for all records, BUT since you can't tell if a text box is
locked by looking at it, it won't matter. As soon as you
click in a different record, the Current event fires and the
text box will be locked or unlocked as needed.

Signature
Marsh
MVP [MS Access]
Bonnie - 23 Mar 2005 14:57 GMT
Hey Marsh!!! How are you? Thanks bunches for the info. It
works GREAT! Hope all is well in your part of the world. I
really appreciate your time. B
>-----Original Message-----
>
[quoted text clipped - 31 lines]
>click in a different record, the Current event fires and the
>text box will be locked or unlocked as needed.