473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Prevent a Specific Value in a Text Field

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
1 1170
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Job Lot | last post by:
In a multi-user environment, how would I prevent users from adding Orders with identical OrderID. For instance I have following tables in my database Order ================== OrderID Identity...
2
by: Danny | last post by:
I have a combo box look up and list items in a table, it is not bound. It works fine but how can I prevent the users from entering in there own data? i have an 'on change' event that when it...
4
by: the hotshot | last post by:
hello, this seems to be a hard question so far and noone has been able to help with this. is it possible to have access start an autonumber with a prefix according to the year when the data is...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
8
by: james | last post by:
I am trying to use Filestream to read a file ( .DAT) that contains values in HEX that I want to convert to text. I know the different offset addresses for each portion of the data I am trying to...
14
by: Ed Jay | last post by:
On a multi-textbox form, linked to an external js, I use onBlur to call: function chkNum(cellname) { var str = document.getElementById(cellname).value.toString(10); if (str < 28 || str > 36)...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
5
by: Vincent | last post by:
I have a bound listbox control on one of my forms that has an associated afterupdate event. When this event is invoked, I lock the control to prevent the user from clicking on it more than once....
6
by: Stanimir Stamenkov | last post by:
I have a form without a submit button like: <form name="form1" action="" onsubmit="alert('submit ' + this.name);"> <div> <label>Field 1: <input type="text" name="field1"...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.