If Macro for Form Field : Limit (1 Viewer)

EdwardsC

New member
Local time
Today, 12:03
Joined
Jul 10, 2019
Messages
21
Hello I need help. I have a drop-down field[SUB size] on my form that shows different size bags (Small, Medium, Large). I test these bags to determine the force before they rip. The larger the bag the larger the force before it rips. I have a calculated field [average pull strength] that averages the force.

I want a message box to pop up to prompt the user to retest because the force is too low. For the BeforeUpdate event in the [average pul strength] I put in a macro:

If (([SUB Size]=Small),([average pull strength]<17),([SUB Size]=Medium),([average pull strength]<20),([SUB Size]=Large),([average pull strength]<23))

Then MsgBox

The macro does not work is my if statement correct?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:03
Joined
Oct 29, 2018
Messages
21,473
Hi. Not sure if the statement is correct but the BeforeUpdate event of calculated controls don't usually fire just because you updated another control used in its calculation. You could test this by simply using a MsgBox without an If statement to see if you get the message at all.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:03
Joined
May 7, 2009
Messages
19,242
build the macro on BeforeUpdate like this
 

Attachments

  • Capture_2019_07_14_826.png
    Capture_2019_07_14_826.png
    9.3 KB · Views: 81

EdwardsC

New member
Local time
Today, 12:03
Joined
Jul 10, 2019
Messages
21
Arnelgp, this worked great thank you.

TheDBguy, you were right in that it does not work in a calculated field. I had to put it in a OnClick event in a save button. This did the trick.

Thanks y'all
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:03
Joined
Oct 29, 2018
Messages
21,473
Arnelgp, this worked great thank you.

TheDBguy, you were right in that it does not work in a calculated field. I had to put it in a OnClick event in a save button. This did the trick.

Thanks y'all

Hi. Congratulations. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom