Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox Function

Status
Not open for further replies.

rl78

MIS
Sep 26, 2002
17
US
Hi All,
I need to create a msgbox function that will only display a message (and not prompt the user for any information or action) when the user types in a value in a field that is greater than 1. I want the message to say "you must create a project plan". Im not sure how to go about this, any help is appreciated.
 
You do an after_update event

Private Sub field1_AfterUpdate()
If field1.Value > 1 Then
MsgBox "You must create a project plan"
End If
End Sub

David Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! [sunshine]
 
If you want to stop them from proceeding, then use the Before Update code instead which passes a Cancel parm. If you set Cancel = true and do me.ControlName.Undo it will reverse the change and put the focus back on the control in question.

Good Luck! Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
If you don't want to mess with coding, you can set properties for the field either in table design view or in form design view:
Code:
Validation Rule: >1
Validation Text: "You must create a project plan"

Note: Changing validation at the table level will enforce the rule for all forms containing the field. Changing validation on a single form will not.

VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top