Message Box

Petros

Registered User.
Local time
Today, 21:24
Joined
Jun 30, 2010
Messages
145
HI all and thanks for all suggestion making this a great place to watch, ask and learn...!
Form A. Text field A.
When closing Form A, i want to inform the user that the value in Text Field A has not changed since opening Form A. If the value has changed (when opening it was 1 and when closing it is 2) i do not what to display any Msg Box..

The motive for this method is to always prompt the user to change values in Text field A.

Thanks!
 
The motive for this method is to always prompt the user to change values in Text field A.

Perhaps you can consider a validation rule if the field doesn't meet your requirements and always bring them back to the field by using something like docmd.gotoControl and name the control.

In addition you could look to colour code it with conditional formatting.

I hope you now have a few options to consider.
 
Perhaps you can consider a validation rule if the field doesn't meet your requirements and always bring them back to the field by using something like docmd.gotoControl and name the control.

In addition you could look to colour code it with conditional formatting.

I hope you now have a few options to consider.


Thanks Trevor, much appriciated... i will try out both options, thanks!
 
Here is another way you can do what you want:

In the On Current event of you form place the following code:

Code:
'store the currnet value of your control in its "Tag" property
Me.NameOfControl.Tag = Me.NameOfControl

Then in the Unload event of your form place the following code:

Code:
'check the value in the "Tag" property of your control
If Me.NameOfControl.Tag = Me.NameOfControlThen
    'if the value in the "Tag" property of the control
    'is the same as the value in the control
    'cancel the closing of the form
    Cancel = True
    'display a message to the user
    MsgBox "Number is the same"
    'set focus to the control that needs to have its value changed
    Me.NameOfControl.SetFocus
End If

Just replace the "NameOfControl" in this code with the actual name of the control that you want to check to see if it has changed.
 
Here is another way you can do what you want:

In the On Current event of you form place the following code:

Code:
'store the currnet value of your control in its "Tag" property
Me.NameOfControl.Tag = Me.NameOfControl

Then in the Unload event of your form place the following code:

Code:
'check the value in the "Tag" property of your control
If Me.NameOfControl.Tag = Me.NameOfControlThen
    'if the value in the "Tag" property of the control
    'is the same as the value in the control
    'cancel the closing of the form
    Cancel = True
    'display a message to the user
    MsgBox "Number is the same"
    'set focus to the control that needs to have its value changed
    Me.NameOfControl.SetFocus
End If

Just replace the "NameOfControl" in this code with the actual name of the control that you want to check to see if it has changed.


This is very interesting Trevor..indeed...

i suppose i can alos put this in the context of AND:

If Me.NameOfControl.Tag = Me.NameOfControl And
If Me.NameOfControl = "Flower" Then
Cancel = True
Else
DoCmd.Close
End IF

?

Thanks!
 

Users who are viewing this thread

Back
Top Bottom