By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Prevent a Specific Value in a Text Field

P: n/a
I've thought about this one and apparently can't seem to find a
workable solution, although I'm sure there are a couple. Have two text
fields that can have values concurrently, but cannot have if one of
the fields contain a specific value of "S." I've tried using the
following code and variations to same on the BeforeUpdate Event on the
form. Any assistance to resolve this issue will be appreciated.
Thanks, Dalan

'If Not IsNull(Me!Display1) And Not IsNull(Me!Display2) Then
' If Me!Stock = "S" Then
' MsgBox "You cannot have both a Display Case and a (S) Stock
code. You must choose one or the another.", vbExclamation

'Me!Stock.SetFocus
'Cancel = True
'End If
'End If
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
So what's the problem? The code you gave worked for me. (I made an
quick form with only two text boxes using the names you gave.) You
aren't testing with one of the fields blank are you? If so, you are
failing at the first 'If' every time.

-Paul T.

ot***@safe-mail.net (Dalan) wrote in message news:<50**************************@posting.google. com>...
I've thought about this one and apparently can't seem to find a
workable solution, although I'm sure there are a couple. Have two text
fields that can have values concurrently, but cannot have if one of
the fields contain a specific value of "S." I've tried using the
following code and variations to same on the BeforeUpdate Event on the
form. Any assistance to resolve this issue will be appreciated.
Thanks, Dalan

'If Not IsNull(Me!Display1) And Not IsNull(Me!Display2) Then
' If Me!Stock = "S" Then
' MsgBox "You cannot have both a Display Case and a (S) Stock
code. You must choose one or the another.", vbExclamation

'Me!Stock.SetFocus
'Cancel = True
'End If
'End If

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.