message box

krishnanhemanth

Registered User.
Local time
Tomorrow, 01:48
Joined
Jun 12, 2009
Messages
115
hi everybody
i have a textbox "QTYSUPPLIED"

on CHANGE event i have code
MsgBox "PLEASE CHANGE THE UPDATED VALUE IN THE FORM VENDOR MATERIAL INSPECTION"
its working fine

but the problem is
for every number i change the message keeps popping
for example...i need to change 100 to 253
what it does is
i change the 1 to 2...the message pops
i change the 0 to 5---the message pops up
i change the 0 to 3----the message pops up

i want only 1 message after the textbox is completely updated
i tried this ...
on change event
if me.qtysupplied.onlostfocus then
MsgBox "PLEASE CHANGE THE UPDATED VALUE IN THE FORM VENDOR MATERIAL INSPECTION"
end if
end sub
its giving an error Type mismatch (Error 13)

please help
 
Try putting your code under the after update event instead.
 
i tried
its giving the same error
 
i tried
its giving the same error

Sorry, realized I only read part of the questions. I think that the "onlostfocus" portion is a separate event all together.

I am not sure of the right code, but you don't need to refer to "onlostfocus" if you just want the message box to pop up you would need to tell it to do that, and it would do it after the update occurs if you have the code in the after update event.

I'll see if I can find something more to help you. :)
 
I would do a search for message boxes in this forum but try putting this into the after update event

I think that you just needed to put this in the after update event.

MsgBox "PLEASE CHANGE THE UPDATED VALUE IN THE FORM VENDOR MATERIAL INSPECTION"
 
thankyou for your tipand time

Please post back and let me know what works. I'm curiouse to know the resolution :)
 
If I could chime in....

Lose the code on the On change event. Put it on the After Update. Also lose the code about the lost focus. What will happen is that while you are using the on change, it pops up the message box. This causes the control to lose focus, which fires off the the second message box.

Are you attempting to prevent users from changing the value? Curious as to what the purpose of the message box is when the value of the control is changed.
 
hi
thankyou all for your time
what i really want is
if a qty has been input and then if that qty is to be changed then
it has to give the message
like i mentoned in the first post
 
As Scooterbug said, remove all the code you've used so far, except the code

Code:
Private Sub QTYSUPPLIED_AfterUpdate()
   MsgBox "PLEASE CHANGE THE UPDATED VALUE IN THE FORM VENDOR MATERIAL INSPECTION" 
End Sub
This will pop the warning up anytime a value is entered or changed. Does this fit your needs?

If you only want the message if a number has been entered and then later is changed, use

Code:
Private Sub QTYSUPPLIED_AfterUpdate()
 If Me.QTYSUPPLIED.Value <> Me.QTYSUPPLIED.OldValue Then
  MsgBox "PLEASE CHANGE THE UPDATED VALUE IN THE FORM VENDOR MATERIAL INSPECTION"
 End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom