473,888 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation rule trouble - ensuring values held in one field are less than those held in another field

Hi all,

I am doing a project for university whereby i have to implement a
simple database related to a frozen foods company. I am having some
trouble though creating a validation rule for one of my fields. I
have a table called "Product" and two of the fields included in this
table are "Cost Price" and "Retail Price". I need to create a
validation rule so that the Cost Price is always less than the Retail
Price. I have tried entering all sorts of validation rules into the
Cost Price field such as....

<Retail Price
and
<"Retail Price"

...... but i just can't seem to figure out the validation rule that
will enable me to do what i need to do. I'm not allowed to use Visual
Basic or anything so I'd be really grateful if someone could help me
to devise a simple validation rule that will solve my problem. Thanks
for all the help!

Joey P
Nov 12 '05 #1
2 2696
rkc

"Joey P" <jo************ @yahoo.co.uk> wrote in message
news:9e******** *************** ***@posting.goo gle.com...
Hi all,

I am doing a project for university whereby i have to implement a
simple database related to a frozen foods company. I am having some
trouble though creating a validation rule for one of my fields. I
have a table called "Product" and two of the fields included in this
table are "Cost Price" and "Retail Price". I need to create a
validation rule so that the Cost Price is always less than the Retail
Price. I have tried entering all sorts of validation rules into the
Cost Price field such as....

<Retail Price
and
<"Retail Price"

..... but i just can't seem to figure out the validation rule that
will enable me to do what i need to do. I'm not allowed to use Visual
Basic or anything so I'd be really grateful if someone could help me
to devise a simple validation rule that will solve my problem. Thanks
for all the help!


You can't reference another field in a field level validation rule.
You can reference any number of fields in a record level validation rule.
You need a record level validation rule.

Type
'Validate or restrict data entry in tables'
into the answer wizard in Help.
Click on
'Define a validation rule to control when a record can be saved'


Nov 12 '05 #2
jo************@ yahoo.co.uk (Joey P) wrote in
news:9e******** *************** ***@posting.goo gle.com:
Hi all,

I am doing a project for university whereby i have to implement a
simple database related to a frozen foods company. I am having some
trouble though creating a validation rule for one of my fields. I
have a table called "Product" and two of the fields included in this
table are "Cost Price" and "Retail Price". I need to create a
validation rule so that the Cost Price is always less than the Retail
Price. I have tried entering all sorts of validation rules into the
Cost Price field such as....

<Retail Price
and
<"Retail Price"

..... but i just can't seem to figure out the validation rule that
will enable me to do what i need to do. I'm not allowed to use Visual
Basic or anything so I'd be really grateful if someone could help me
to devise a simple validation rule that will solve my problem. Thanks
for all the help!

Joey P

Since prices are currency, not strings, your second won't work.
< retail price is closer, but the space between the l and the p can
confuse access. Use < [Retail Price], or do the smart thing and rename
the field Retail_Price. Those pesky spaces can do all sorts of mayhem.

I once spent 3 days tracking down a problem with somebody's table where
they had put two (2) spaces between words in a few columns. Whith a small
proportional font, I just couldn't see the extra ones.

Good luck.

Bob Q

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3940
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 adresses and so on. I thought it might be a better way to programm an automated, dynamic form validation that works for all kinds of fields, shows the necessary error messages and highlights the coresponding form fields.
2
10427
by: Doslil | last post by:
I am trying to validate the fields in my database.I have already validated the fields to check for not null.Here is what I have written for Numeric and text field. Private Function EENUM() On Error GoTo EENUMErr If IsNull(Me.EmployeesID) Or Me.EmployeesID = "" Or Me.EmployeesID < 0 Then MsgBox "Employee Number Cannot Be Left Blank", vbOKOnly, "Employee Number"
2
3888
by: Kostas | last post by:
Just a quick question on this issue. Assume a small set of fixed values for a field. For instance Field Gender, values: Male, Female, Unknown If I create a Combo Box with the above values, I believe I am adding a form-level validation. Is it wise to also include the table-level validation for the above constraint? For instance, go to the field's validation rule property in Design Mode and
5
1824
by: Don Sealer | last post by:
I've got a validation rule that says something like =xx or xxx or zzzz. Though I may not have described it well it does work fine and that is really not my question. Here's what I'd like to do. Let's say that I choose zzzz, I'd like for a particular control (or text box) in my form to become required. At other times, if xx or xxx is inputed it would not be required. Is this possible? Thanks, and as always, further explanatiions...
1
1427
by: jujubean | last post by:
I have a table which is populated using paste append from excel. I want to allow records only if the value of one field matches one of many values in a field in another table. I tried to set the validation rule In(.) where TableName is the table containing the valid values and FieldName is the field containing those values. I get an error message stating the field could not be found. Any suggestions?
3
6348
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 older version that I am updating. Thus I get this message. It tells me only how many records have errors, not which errors or which records. Anyone have a nice solution to identifying the specific records involved? Maybe even the specific...
10
5738
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the form the control is on? Basically I have a number of controls in a form that are required, and to check it I am setting the Validation Rule to "<>"IsNull" so that when the user tries to tab through/click out of a required area without entering...
7
5980
by: sharsy | last post by:
Hi guys, I would like to setup a validation rule for a database in microsoft access that restricts data entry so that a certain field can only be filled in if another field has a specific answer (that is selected via a drop down list). Example Field1 - options are "In" or "Out" Field2 - options are "Join" or "Not Joining"
4
2161
by: jehugaleahsa | last post by:
Hello: Is it me, or is handling the Validating event for every control on a form extremely annoying? It is especially annoying when my business logic repeats most of the validation. Some things you can handle in the business logic. But other things, like ensuring a textbox represents a number or null, requires a developer's intervention. I am asking whether or not there is an easier way of doing validation for data bound controls.
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11178
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10777
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10882
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10438
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9597
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7148
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3251
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.