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
3 5141 ADezii 8,834
Recognized Expert Expert
You may be better off setting the Validation Tests in the BeforeUpdate() Event of a Form: -
Private Sub Form_BeforeUpdate(Cancel As Integer)
-
Debug.Print Me![Event End] & " ==> & Me![Event Ongoing)"
-
If IsNull(Me![Event End]) And Me![Event Ongoing] = True Then
-
MsgBox "If there is no Event End Date, then Event OnGoing " & _
-
"cannot be checked", vbExclamation, "Rule Violation"
-
Cancel = True
-
Exit Sub
-
ElseIf Not IsNull(Me![Event End]) Then
-
Me![Event Resolved] = True
-
ElseIf Me![Event Resolved] = True Then
-
Me![Event Ongoing] = False
-
Else
-
'fall through
-
End If
-
End Sub
-
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)>
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 parent table, multiple records
in a child table are affected. However, I'm a bit weak on programming
experience. INSERT INTO is not suitable. Any ideas?
When the combo box update property is triggered, the code needs to
accomplish:
IF...
|
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 the Microsoft XP Developer Packaging Wizard (Service Pack 1). The 1st
3 releases of the app ran perfectly on
site.
|
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 a table that is bound to the
island (such that the rows are dynamically generated by IE
from the XML data island), the validators do not work. If
the table is not bound, the validators do work, but then I
don't have the table iterating through...
|
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...
|
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
| |
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 there an equivalent property for the
DataGridView? I have searched, but have not found one.
I would like the user to be able to see all the columns of the table on one
screen - thus eliminating the need to use the horizontal scroll bar to view...
|
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 it. We are building a database for a condo rental company and the rental transaction table includes an arrival date and a departure date. We need to write a table-level validation rule that indicates the departure date is seven days after the...
|
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 have never actually learnt VB so my request is that you bear this in mind if you plan on replying to this post.
My request for help is as follows:
I have an MS Access database in which one of the tables within it contains two date fields called...
|
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"
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
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...
| |