Unlock a Locked Field

A

Alan Z. Scharf

1. I have a Locked field called Active in a contacts database.

2. The The yes/no status of this field is automatically determined by a
stored procedure.

3. Sometimes it is necessary for a user to override the automatically
determined status of the contact.

4. Is it possible to unlock this field with a mouse-click on it?

5. I tried the GotFocus, Enter, Click and MouseDown events, but they don't
respond. No msgbox pops up per code below.

6. Or do I need a separate button to do this?

Thanks.

Alan


Private Sub ActiveManager_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
' Purpose: To override automatic Active setting

Dim strMessage As String

strMessage = ("The Active field is automatically updated with every
bi-weekly Valuation, based on actual holdings in the most recent period." &
BlankLine)
strMessage = (strMessage & "There is no need to change this unless a
manager is now considered Active prior to the next Valuation." & BlankLine)
strMessage = (strMessage & "Are you sure you want to change the Active
status now?")

Response = MsgBox(strMessage, vbYesNo, "Override Active?")
If Response = vbYes Then
Me.Activemanager.Locked = False
Me.Activemanager.ForeColor = 0
Me.Activemanager.SetFocus
End If
End Sub
 
F

fredg

1. I have a Locked field called Active in a contacts database.

2. The The yes/no status of this field is automatically determined by a
stored procedure.

3. Sometimes it is necessary for a user to override the automatically
determined status of the contact.

4. Is it possible to unlock this field with a mouse-click on it?

5. I tried the GotFocus, Enter, Click and MouseDown events, but they don't
respond. No msgbox pops up per code below.

6. Or do I need a separate button to do this?

Thanks.

Alan

Private Sub ActiveManager_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
' Purpose: To override automatic Active setting

Dim strMessage As String

strMessage = ("The Active field is automatically updated with every
bi-weekly Valuation, based on actual holdings in the most recent period." &
BlankLine)
strMessage = (strMessage & "There is no need to change this unless a
manager is now considered Active prior to the next Valuation." & BlankLine)
strMessage = (strMessage & "Are you sure you want to change the Active
status now?")

Response = MsgBox(strMessage, vbYesNo, "Override Active?")
If Response = vbYes Then
Me.Activemanager.Locked = False
Me.Activemanager.ForeColor = 0
Me.Activemanager.SetFocus
End If
End Sub

Use the control's Double-click event to unlock it:
Me![ControlName].Locked = False

Then lock it again in the control's AfterUpdate event.
Me![ControlName].Locked = True
 
A

Alan Z. Scharf

Fred,

Thanks very much.

Now it seems obvious!

Regards,

Alan

fredg said:
1. I have a Locked field called Active in a contacts database.

2. The The yes/no status of this field is automatically determined by a
stored procedure.

3. Sometimes it is necessary for a user to override the automatically
determined status of the contact.

4. Is it possible to unlock this field with a mouse-click on it?

5. I tried the GotFocus, Enter, Click and MouseDown events, but they don't
respond. No msgbox pops up per code below.

6. Or do I need a separate button to do this?

Thanks.

Alan

Private Sub ActiveManager_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
' Purpose: To override automatic Active setting

Dim strMessage As String

strMessage = ("The Active field is automatically updated with every
bi-weekly Valuation, based on actual holdings in the most recent period." &
BlankLine)
strMessage = (strMessage & "There is no need to change this unless a
manager is now considered Active prior to the next Valuation." & BlankLine)
strMessage = (strMessage & "Are you sure you want to change the Active
status now?")

Response = MsgBox(strMessage, vbYesNo, "Override Active?")
If Response = vbYes Then
Me.Activemanager.Locked = False
Me.Activemanager.ForeColor = 0
Me.Activemanager.SetFocus
End If
End Sub

Use the control's Double-click event to unlock it:
Me![ControlName].Locked = False

Then lock it again in the control's AfterUpdate event.
Me![ControlName].Locked = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top