473,387 Members | 3,684 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,387 software developers and data experts.

Access Validation Rules

I have been trying to set a validation rule in my Database. I have 5 related tables but cannot set a validation rule for the Date. The scenario says that" A course cannot run with less than 5 people 2 weeks before the course is due to begin" Could any body help?
Mar 6 '07 #1
7 1675
noks
19
Am trying to understand what u wanna do but unfort. am not succidin. Can u pls elaborate mo. ie. where r u gonna put yo code, give us yo code so dat we can c where we can modify etc
Mar 6 '07 #2
Rabbit
12,516 Expert Mod 8TB
This can't be done using a validation as both class size and current date will be changing all the time.

You'll have to use a query that selects the records with <= 5 students and whether or not the class is scheduled to start within 2 weeks. Then run that query whenever you want to see if there are any such classes. You could, if you want, program this to run automatically each time the database is opened. Either through a macro or through code on a form. I prefer the latter.
Mar 6 '07 #3
ADezii
8,834 Expert 8TB
I have been trying to set a validation rule in my Database. I have 5 related tables but cannot set a validation rule for the Date. The scenario says that" A course cannot run with less than 5 people 2 weeks before the course is due to begin" Could any body help?
You have provided very limited information but the Logic is as follows:
Expand|Select|Wrap|Line Numbers
  1.     'Difference between Begin and Apply Dates > 14
  2. 1. [Course Begin Date]-[Course Apply Date]>14    
  3.  
  4.     'The number of people taking this specifc Course must be > 5     
  5. 2. DCount("*", "<your Table>", "[Course ID] = " & <Course ID>) >=5      
  6.  
  7. NOTE: Both conditions must be satisfied, mainly:
  8. Condition1 AND Condition 2 
Mar 6 '07 #4
Rabbit
12,516 Expert Mod 8TB
You have provided very limited information but the Logic is as follows:
Expand|Select|Wrap|Line Numbers
  1.     'Difference between Begin and Apply Dates > 14
  2. 1. [Course Begin Date]-[Course Apply Date]>14    
  3.  
  4.     'The number of people taking this specifc Course must be > 5     
  5. 2. DCount("*", "<your Table>", "[Course ID] = " & <Course ID>) >=5      
  6.  
  7. NOTE: Both conditions must be satisfied, mainly:
  8. Condition1 AND Condition 2 
The problem isn't that they're comparing one static date [Start Date] to another static date [Apply Date]. They want to validate depending on Current Date.
Mar 6 '07 #5
ADezii
8,834 Expert 8TB
The problem isn't that they're comparing one static date [Start Date] to another static date [Apply Date]. They want to validate depending on Current Date.
Wouldn't a simple substitution of Date() instead of [Course Apply Date] be sufficient?
Mar 6 '07 #6
Rabbit
12,516 Expert Mod 8TB
Would that work in a validation rule for a field in a table? I'm unsure of how that would play out.
Mar 6 '07 #7
Rabbit
12,516 Expert Mod 8TB
I just tested it using minutes. It only checks when you first enter the data, after that there's no check unless you change the data. Problem is Date() will keep changing and what they want is a continuous check for classes that are about to start that have <= 5 students enrolled.

I'm thinking they'll have to go with a query that runs automatically when they open the database.
Mar 6 '07 #8

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

Similar topics

1
by: Mike | last post by:
Note: My XML experience to date has (unfortunately) been limited to reading and thinking, rather than implementation. Anyway, I am in the process of trying to figure out the most efficient way...
2
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For...
67
by: Scott Meyers | last post by:
I have a web site that, due to maintenance by several people, some of whom are fairly clueless about HTML and CSS, etc. (notably me), has gotten to the point where I'm pretty sure it's suffering...
2
by: qsweetbee | last post by:
I have a form(fAddUsers) in my database. It is continue form for data entry. Some fields are required fields. Some are optional fields. There is 1 particular filed(TokenExpirationDate)on the form...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
5
by: Jeremy | last post by:
I have a vb .net 2003 app that uses access 2k as a backend. The main table has some validation rules (legacy stuff brought forward inadvertantly, and now we're stuck with 'em). The problem is,...
3
by: tsnyder | last post by:
I need to set a validation rule for a field so that it looks at all other fields to make sure that field is true.
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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,...

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.