A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to restrict a date from being entered



 
 
Thread Tools Display Modes
  #1  
Old March 14th, 2005, 05:07 PM
HayabusaMan
external usenet poster
 
Posts: n/a
Default How to restrict a date from being entered

How to restrict a date from being entered Example: start date/ end date

  #2  
Old March 14th, 2005, 05:11 PM
Rick B
external usenet poster
 
Posts: n/a
Default

Huh?

If you are asking for a date, why do you want to prevent one from being
entered. Hav no idea what you are asking. Feel free to post full sentences
explaining what you are trying to do, including examples.

Rick B


"HayabusaMan" wrote in message
...
How to restrict a date from being entered Example: start date/ end date



  #3  
Old March 15th, 2005, 11:15 AM
Jamie Collins
external usenet poster
 
Posts: n/a
Default


Rick B wrote:
How to restrict a date from being entered Example: start date/ end

date

If you are asking for a date, why do you want to prevent one from

being
entered.


Commonsense business rules:

1) start_date must have a value, default to current date:

CREATE TABLE Test (
key_col INTEGER NOT NULL,
start_date DATETIME DEFAULT DATE() NOT NULL,
end_date DATETIME,
PRIMARY KEY (start_date, key_col)
);

2) end_date cannot being earlier than start_date:

ALTER TABLE Test ADD CONSTRAINT
non_sequential_dates CHECK (start_date = end_date);

3) When INSERTed, start_date must always equal the current date on the
server:

ALTER TABLE Test ADD CONSTRAINT
start_date_not_current CHECK (start_date = DATE());

In order to stop a column from being UPDATEd, revoke all permissions
for the table and provide a PROCEDURE as the only means to INSERT a row
and a VIEW to be able to only read the table etc. For details, see the
security FAQ.

Jamie.

--

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aggregating Date Data into Weeks and Quarters Roger Running & Setting Up Queries 3 July 11th, 2004 05:56 PM
If statement Doug Worksheet Functions 9 June 28th, 2004 06:13 AM
more dates!!! brigid Running & Setting Up Queries 6 May 26th, 2004 10:59 AM
Formatting dates in Excel bernrunner15 New Users 4 May 11th, 2004 10:32 PM


All times are GMT +1. The time now is 05:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.