>From this newsgroup, I was very happy to be able to enable or disable
>controls on my form, depending upon whether there was data already entered in
[quoted text clipped - 10 lines]
>a way to make this happen as soon as I populate the control and move on to
>another control? I have made a few attempts, but they don't work.
Use the appropriate line of code in each of the controls'
AfterUpdate event.

Signature
Marsh
MVP [MS Access]
dee - 30 Jan 2008 20:57 GMT
Thanks for your response.
I actually did try to add code to the individual control's AfterUpdate
event, but wasn't successful.
Would you have any advice on what the code should be?

Signature
Thanks!
Dee
> >From this newsgroup, I was very happy to be able to enable or disable
> >controls on my form, depending upon whether there was data already entered in
[quoted text clipped - 13 lines]
> Use the appropriate line of code in each of the controls'
> AfterUpdate event.
Marshall Barton - 30 Jan 2008 21:53 GMT
>Thanks for your response.
>
>I actually did try to add code to the individual control's AfterUpdate
>event, but wasn't successful.
>
>Would you have any advice on what the code should be?
The code should be exactly the same as what you used in the
Current event, except that you only need the one appropriate
line for for each control. E.g.
Private Sub cbo_ppt_no_AfterUPdate()
Me.cbo_ppt_no.Locked = Not IsNull(Me.cbo_ppt_no)
End Sub

Signature
Marsh
MVP [MS Access]
dee - 30 Jan 2008 21:24 GMT
On another note, I am now having problems using the code when I have a
default of, say the text LU at the beginning of the control. In other words,
if the control contains only 2 letters, then don't lock.
I have tried this in my On Current form event - the first line works fine -
the second not at all:
Me.box_no.Locked = Not IsNull(Me.box_no)
Me.txt_ppt_no.Locked = Not Len(Me.txt_ppt_no) = 2
Help! :-)

Signature
Thanks!
Dee
> >From this newsgroup, I was very happy to be able to enable or disable
> >controls on my form, depending upon whether there was data already entered in
[quoted text clipped - 13 lines]
> Use the appropriate line of code in each of the controls'
> AfterUpdate event.
Marshall Barton - 30 Jan 2008 22:03 GMT
>On another note, I am now having problems using the code when I have a
>default of, say the text LU at the beginning of the control. In other words,
[quoted text clipped - 5 lines]
>
> Me.txt_ppt_no.Locked = Not Len(Me.txt_ppt_no) = 2
This should do that:
Me.txt_ppt_no.Locked = Len(Nz(Me.txt_ppt_no, "XX") <> 2
If that's too cryptic, an equivalent, but longer, statement
is:
Me.txt_ppt_no.Locked = Len(Me.txt_ppt_no) <> 2 _
And Not IsNull(Me.txt_ppt_no)

Signature
Marsh
MVP [MS Access]