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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force entry on field depending on value of combo box

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
0
0
US
I'm looking to add some sort of validation to a field on a form so that you can't enter past the field if the value is true. For example, I have the following two fields:

1. Order Status
2. Comments

Again, I want to add validation that would be like this:

If order status = "Completed" then do not allow users to tab off of the [Comments] field until the value of the comments field is > " " (spaces).

Can that be done? Please help!
 
Sure, just set an On Exit event for the Comments field that reads something like:

If Me.OrderStatus = "Completed" and Me.Comments is null Then
MsgBox "Yo chump! You didn't fill out the Comments field!"
DoCmd.GoToControl Me.Completed.Name
End If
 
When using this logic, I receive a Run-time error '424'. Do you know why I would be receiving this???

 
This error that I'm receiving is an object error. Is the object "Is Null" legit, and if so, will it work when comparing a memo field?
 
Try this

Private Sub OrderComments_Enter()
If IsNull(Me!OrderComments) and Me!OrderStatus = "Order Canceled" then
Msgbox "You must enter comments if order is cancelled"
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top