How to pop up a message when the field is locked? (1 Viewer)

sirkistova

Registered User.
Local time
Today, 17:49
Joined
May 3, 2009
Messages
23
Hello
I made an "Options" form in my DB to edit some fields.
When a field is used by a reoprt that is open, that fields in "Options" form is locked.
This is fine, but the user has to know why is it suddenly locked.
How can I make it pop up a message when the field is locked due to report that uses it open?
Thanks
Tova
 

boblarson

Smeghead
Local time
Today, 07:49
Joined
Jan 12, 2001
Messages
32,059
If the field is locked but still enabled you can use the GotFocus event of that control and use:
Code:
If Me.ControlName.Locked = True Then
   MsgBox "This control is locked because....etc.", vbInformation
End If
 

sirkistova

Registered User.
Local time
Today, 17:49
Joined
May 3, 2009
Messages
23
I tried that but the value of Me.ControlName.Locked
is always false. Even when it is really locked.
:(
Tova
 

boblarson

Smeghead
Local time
Today, 07:49
Joined
Jan 12, 2001
Messages
32,059
I tried that but the value of Me.ControlName.Locked
is always false. Even when it is really locked.
I just tested on my own form and it doesn't do what you are saying happens. It actually works fine for me, so I need more information as to what may be happening.

Please explain how you are trying to implement it.
 

sirkistova

Registered User.
Local time
Today, 17:49
Joined
May 3, 2009
Messages
23
This is the function:

Public Function event_PetekFooter_GetFocus()
MsgBox Me.PetekFooter.Locked
If Me.PetekFooter.Locked = True Then
MsgBox "This field is locked because a report that uses it is open.", vbInformation
End If
End Function

It is located at the code of the form.
The line: MsgBox Me.PetekFooter.Locked
is for debugging. The msgbox always shows False, even when the field is blocked and beeps when I try to edit it.

Thanks
Tova
 

spikepl

Eledittingent Beliped
Local time
Today, 16:49
Joined
Nov 3, 2010
Messages
6,142
Have you considered bypassing the problem? If you open the report with WindowMode=acDialog, then the focus stays on the report until it's closed.
 

Users who are viewing this thread

Top Bottom