Syntax for Unlocking Control on New Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could someone please give me some pointers on locking a combo box after data has been selected from the pull down list and unlocking it on the addition of a new record? I can lock it no problem on the after change event but can't unlock it when I go back to the control on a new record. If could write the code in english it would read

On_Chnag
Me.BldgLocation.Locked = Tru
When Me.BldgLocation.NewRecord.Locked = Fals

I know my syntax is goofy but I'm a newbie and still trying.
 
Use the Current event of the form:

Private Sub Form_Current()
If Me.NewRecord Then
Me.BldgLocation.Locked = False
Else
Me.BldgLocation.Locked = True
End If
End Sub

That will need error handling to move the focus to another control if
BldgLocation has focus.

You can also use the AfterUpdate event of BldgLocation if desired.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MBoozer said:
Could someone please give me some pointers on locking a combo box after
data has been selected from the pull down list and unlocking it on the
addition of a new record? I can lock it no problem on the after change event
but can't unlock it when I go back to the control on a new record. If could
write the code in english it would read.
 
Thanks a mil Allen. Sure appreciate you taking the time to hel;p a newbie with a little syntax.
 
Back
Top