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

Help Please

I have two columns in a table;

BLDG_ID
CELL_ID

If one is null, then the other cannot be.
Also, if one is not null, then the other must be.

How do I write that in the validation rule on the table itself.

Thanks much.
Feb 22 '07 #1
4 1223
maxamis4
295 Expert 100+
As of now I do not know of a way to do this. In Microsoft SQL server there are procedures and triggers that come to mind to stop this. But in access the only way i know to do data validation is through forms. Usually that involves some visual basic which is pretty simple.

Let me know if you need help
Feb 22 '07 #2
ADezii
8,834 Expert 8TB
I have two columns in a table;

BLDG_ID
CELL_ID

If one is null, then the other cannot be.
Also, if one is not null, then the other must be.

How do I write that in the validation rule on the table itself.

Thanks much.
Berts76 - you really taxed my brain on this one, but in the Table Properties Dialog under Validation Rule:

(IsNull([BLDG_ID]) And Not IsNull([CELL_ID])) Or (IsNull([CELL_ID]) And Not IsNull([BLDG_ID])) Or
(Not IsNull([BLDG_ID]) And IsNull([CELL_ID])) Or (Not IsNull([CELL_ID]) And IsNull([BLDG_ID]))
Feb 23 '07 #3
maxamis4
295 Expert 100+
Learn something new everyday
Feb 23 '07 #4
I had to do it in the form. I set the BeforeUpdate event property of the form to the name of my macro.

I then created a macro with the following condition:

[Cell_ID] And [BLDG_ID] Is Not Null

and the action to MSG "Invalid Entry"

the next action (same condition) to CancelEvent.

Now when you use the form to add a new record, Microsoft Access runs the validation macro after you finish entering the new record, but before it saves the record in the table. If the condition in the macro is met, Access displays the appropriate message and doesn't save the record in the table. It will take you back to the record to make a change.

BTW, I got this information directly from the help files under Validation Rules, About Validating Data Programatically.
Feb 23 '07 #5

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

Similar topics

1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
12
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.