MsgBox Based on Text Box Value

diensatthan

Registered User.
Local time
Today, 14:43
Joined
Apr 27, 2003
Messages
14
I need to know how to display a message whenever the value of a bounded Text Box (Enabled = No) on a form is ZERO when navigating. Thanks.
 
Use the OnCurrent Event of your form.

Code:
Private Sub Form_Current()

    If Me.txtYourTextbox = 0 Then
        MsgBox "Hey, it's a 0 value!", vbInformation, "0 Found"
    End If

End Sub
 
Also, on the Form's Load() event put this line:

Call Form_Current
 
Mile-O-Phile: Your additional suggestion (Call Form_Current) in Form_Load produced 2 MsgBox PRIOR to the form display, if the first record is applicable. Please HELP!
 
Silly me! I can see why it's giving you two message boxes.

I'm messing about with a small sample just now - will post back.
 
Last edited:
Well, I recreated your problem but don't know how to wait until the form is drawn before the message box is triggered on the first record.

If anyone can help then here's the test I made - show us how it's done.:p
 

Attachments

G'day all.

A small delay using the timer event should do the trick.
After the Timer is called the first time, its Interval is reset to zero.
A Boolean Flag is set to True and Form_Current is Called.

Modified demo attached.

Hope that helps
Chris
 

Attachments

Users who are viewing this thread

Back
Top Bottom