Chintsapete
Registered User.
- Local time
- Today, 02:11
- Joined
- Jun 15, 2012
- Messages
- 137
Hi Guys
I'm a lousy beginner in VB and been piecing together code from some of you guys in the forum. What I'm trying to do is prevent accidental data change. Below code works as far as locking the control after update and unlocking it on double click. What I can’t figure out is: How do I get the code to select the content of the field so I can just type in the correction. I don’t imagine it do be that difficult but I just can't figure it out. Any help would be appreciated.
Thanks
Pete
Private Sub Morn_AfterUpdate()
DoCmd.RunCommand acCmdRefresh
DoCmd.OpenQuery "CB01 Morning shift D", acViewNormal, acEdit
DoCmd.OpenQuery "CB01 Morning shift", acViewNormal, acEdit
DoCmd.RunCommand acCmdRefresh
With Me
If Me.NewRecord Then
.Morn.Locked = False
Else
.Morn.Locked = (Len(.Morn & vbNullString) > 0)
End If
End With
End Sub
Private Sub Morn_DblClick(Cancel As Integer)
With Me
.Morn.Locked = False
End With
End Sub
I'm a lousy beginner in VB and been piecing together code from some of you guys in the forum. What I'm trying to do is prevent accidental data change. Below code works as far as locking the control after update and unlocking it on double click. What I can’t figure out is: How do I get the code to select the content of the field so I can just type in the correction. I don’t imagine it do be that difficult but I just can't figure it out. Any help would be appreciated.
Thanks
Pete
Private Sub Morn_AfterUpdate()
DoCmd.RunCommand acCmdRefresh
DoCmd.OpenQuery "CB01 Morning shift D", acViewNormal, acEdit
DoCmd.OpenQuery "CB01 Morning shift", acViewNormal, acEdit
DoCmd.RunCommand acCmdRefresh
With Me
If Me.NewRecord Then
.Morn.Locked = False
Else
.Morn.Locked = (Len(.Morn & vbNullString) > 0)
End If
End With
End Sub
Private Sub Morn_DblClick(Cancel As Integer)
With Me
.Morn.Locked = False
End With
End Sub