Validation Language

  • Thread starter Thread starter knowshowrosegrows
  • Start date Start date
K

knowshowrosegrows

Can someone give me an expression?

When the user puts a number in textbox "Census" that is larger than the
number in field "Capacity," I want to give them a message box that says "The
Census is higher than the Capacity. Is that correct?" Regardless of what
they choose, they are allowed to put any number in "Census."
 
One approach might be to add code to the AfterUpdate event of the control
that gets [Census].

In that event procedure, you'd check to see if [Census] was greater than
[Capacity]. If it were, you could pop up a message box.

The code in the AfterUpdate event might look something like:

If Me![Census] > Me![Capacity] Then
MsgBox "The Census is higher than the Capacity. Is that correct?",
vbOKOnly, "Insert your messagebox title here"
End If

By the way, you could use this approach to react differently if they decide
it isn't correct...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
As Linq points out, you'll also want to make sure a change to [Capacity]
triggers the test.

Another way to do that is to include something like the following in the
AfterUpdate event for [Capacity]:

Call Census_AfterUpdate()

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top