473,769 Members | 6,739 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 2689
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
3920
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
10420
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
3879
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
1818
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
1423
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
6338
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
5723
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
5971
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
2154
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
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
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
10049
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...
0
9865
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
8873
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...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.