473,405 Members | 2,444 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,405 software developers and data experts.

?Multiple Validation Rules for Table?

14
Hi Experts,

I have just completed designing a new DB and my boss has asked me to put some complicated (I think!) validation rules on to it. My table is below:
1. Index - Autonumber
2. Hospital Number - Text (FK)
3. Unexpected Adverse Event - Text (with combo box)
4. SAE - Yes/No
5. Date event start - Date/Time
6. Date event end - Date/Time
7. Grade - Text (with combo box)
8. Event ongoing - Yes/No
9. Event resolved - Yes/No
10. Treatment required - Yes/No
11. Comment - memo
What my boss is looking for is:
1. 'Event ongoing' cannot be ticked if there is no date in for 'event end'
2. 'Event resolved' is automatically ticked if there is a date in for 'event end'
3. 'Event ongoing' cannot be ticked if 'event resolved' is ticked.

I have tried searching for how to do this and the only thing that I have come up with is a table validation rule but it seems that you can have one rule for this.

Can anyone point me in the right direction, am I looking for a validation rule or is it code that I need.

As usual thanks a million for your time.

Baba
Jul 10 '08 #1
3 5116
ADezii
8,834 Expert 8TB
You may be better off setting the Validation Tests in the BeforeUpdate() Event of a Form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. Debug.Print Me![Event End] & " ==> & Me![Event Ongoing)"
  3. If IsNull(Me![Event End]) And Me![Event Ongoing] = True Then
  4.   MsgBox "If there is no Event End Date, then Event OnGoing " & _
  5.          "cannot be checked", vbExclamation, "Rule Violation"
  6.   Cancel = True
  7.     Exit Sub
  8. ElseIf Not IsNull(Me![Event End]) Then
  9.   Me![Event Resolved] = True
  10. ElseIf Me![Event Resolved] = True Then
  11.   Me![Event Ongoing] = False
  12. Else
  13.   'fall through
  14. End If
  15. End Sub
  16.  
Jul 10 '08 #2
missinglinq
3,532 Expert 2GB
As has been said, this type of validation is best done at the form level, and in point of fact, all data entry should be done thru a form. Allowing users to enter data directly into a table, as your table field list suggests, is a sure recipe for corruption.

Welcome to Bytes!

Linq ;0)>
Jul 11 '08 #3
babamc4
14
Hi All

Sorry I should have said I have a mainform with the above table as a subform on it. All the data will be entered via the mainform as I will be putting Allen Browne's Audit trail on to the DB.

Can I use code along with the audit trail?

Is the table safe from corruption if data entry is done via forms?

Thanks again for your replies

Baba
Jul 11 '08 #4

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

Similar topics

2
by: news.hp.com | last post by:
I have situation where I need to copy multiple records (only certain fields) from a Rules table to an Events table based on a selection identified in a combo box. When the selection is made in a...
18
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
10
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...
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
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
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...
3
by: Harlequin | last post by:
I must start this posing by making the point that I am NOT a VB programmer and I'm something of a Newbie to MS Access. I can program in a number of languages (Java, Javascript, PERL,PHP and TCL) but...
7
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...
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
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...
0
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...
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
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...

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.