Making a Message Box if {objects number} =>10 show message

dawsonrhodes

Member
Local time
Today, 13:47
Joined
Mar 8, 2020
Messages
85
Hello!

I am trying to make a code that will open a message box is the "txtEmerg" box is = to or > than "10" to display a message that Emergency Days Have Been Exhausted.

I have no experience with VBA Code and would love to learn but start small.

Capture.PNG


Any help you can offer would be greatly appreciated!

- Dawson
 
Hi Dawson. To create a message box, you'll need an event to trigger it. How does the number change in the txstEmerg box? If it's not being changed by some event, then the next best thing is to have a Textbox, rather than a message box, to display your message. It will only display the message when the condition is met.
 
Hi Dawson. To create a message box, you'll need an event to trigger it. How does the number change in the txstEmerg box? If it's not being changed by some event, then the next best thing is to have a Textbox, rather than a message box, to display your message. It will only display the message when the condition is met.
Hello!

The event would ideally be on load, or on update. The control source for this is ** =CDbl(Nz(Sum([Number of Days E]),0)) ** which reads from the Query that calculates the number of days the employee is absent for. So when I load up my form, one of the tabs is a datasheet and that image of statistics which update when the record is either closed or reloaded.

Not sure if that makes sense....
 
Hello!

The event would ideally be on load, or on update. The control source for this is ** =CDbl(Nz(Sum([Number of Days E]),0)) ** which reads from the Query that calculates the number of days the employee is absent for. So when I load up my form, one of the tabs is a datasheet and that image of statistics which update when the record is either closed or reloaded.

Not sure if that makes sense....
Yes, you could use the Form's Load event to check if the result of the calculation for the textbox meets your criteria and then display the message box.
 
Yes, you could use the Form's Load event to check if the result of the calculation for the textbox meets your criteria and then display the message box.
Any chance you would know a code to work??? Sorry to bother I have searched and can't find what I'm looking for exactly.
 
I just dont understand how to write a code to say if it is => “10” then display
You would use the name of the control. For example, if the name of the control is txtEmerg, then you could try:
Code:
If Me.txtEmerg >= 10 Then
    MsgBox "blah.."
End If
 

Users who are viewing this thread

Back
Top Bottom