473,413 Members | 1,733 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,413 software developers and data experts.

Validation rules with IIF statements

76
Hello,

I have a text box on a form where people enter numbers. How can I get it to not accept any number greater than 2 if a different text box is "Credit Hours" but to accept any number if it is anything other than "Credit Hours"?

Thanks,

Charlie
Nov 1 '06 #1
5 5950
pks00
280 Expert 100+
Hello,

I have a text box on a form where people enter numbers. How can I get it to not accept any number greater than 2 if a different text box is "Credit Hours" but to accept any number if it is anything other than "Credit Hours"?

Thanks,

Charlie

one way is to use the BeforeUpdate event of the textbox
i.e.

private sub mytxtbox_BeforeUpdate(cancel as Integer)
If Me.othertextbox = "Credit Hours" And mytxtbox.Value > 2 Then
msgbox "Sorry but value cannot be 2 if Credit Hours selected"
Cancel = True
End if
end sub
Nov 1 '06 #2
ckpoll2
76
Where would I put that information that you gave me? Does that go in the expression builder or the code builder? Can I enter it just as is?

Thanks for your help
Nov 2 '06 #3
NeoPa
32,556 Expert Mod 16PB
Assuming the number TextBox is called txtNum and the other txtType then put
Expand|Select|Wrap|Line Numbers
  1. [txtNum]<3 or [txtType<>"Credit Hours"
into the 'Validation Rule' property of txtNum.
The 'Validation Text' property can be set to your own error message.
Nov 2 '06 #4
ckpoll2
76
That's amazing. Thanks so much for your help.

Charlie
Nov 2 '06 #5
PEB
1,418 Expert 1GB
for the code provides by pks00 you can put it in a form, in the respective field you want to check....

But obviously you are working with the table directly :)
Nov 4 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
1
by: Mike | last post by:
Note: My XML experience to date has (unfortunately) been limited to reading and thinking, rather than implementation. Anyway, I am in the process of trying to figure out the most efficient way...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
67
by: Scott Meyers | last post by:
I have a web site that, due to maintenance by several people, some of whom are fairly clueless about HTML and CSS, etc. (notably me), has gotten to the point where I'm pretty sure it's suffering...
41
by: Gérard Talbot | last post by:
Cross-posted to: comp.infosystems.www.authoring.html and alt.html Followup-to: comp.infosystems.www.authoring.html 1- One day, I stumbled across a website that offers to validate webpages. What...
35
by: Mika M | last post by:
Simple question: Does Framework (1.1) contain any routine to check entered email-address is valid ? It's quite easy to make own code for that purpose, but why to do if Framework (1.1) contain...
3
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
3
by: Phil Latio | last post by:
I am designing a relatively simple CMS with the usual Item, Category and User scenario. My question here relates to how I implement the User registration on this application. Currently I have the...
6
by: Ledmark | last post by:
Hello - I am in a class for Access 2007 Database apllication design and we are covering types of Validation rules. We have a problem that I'm trying to solve but have no idea how to go about writing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.