Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making Validation Rules
Message
 
To
16/03/1999 04:46:16
Yin Min Chen
Nec Home Electronics(M) Sdn Bhd
Sungai Petani, Malaysia
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00197965
Message ID:
00198016
Views:
51
>I'm acessing to MS Access Database. Currently I have a table called "period". The fields in this table are :
>1) YearNum Integer
>2) PeriodNum Integer
>3) StartDate Date
>4) EndDate Date
>
>The records in the table can not have a StartDate and EndDate overlap with the other records. Eg,If the table already have a record below :
>YearNum=1999, PeriodNum=1, StartDate=01-Jan-1999, EndDate=31-Jan-1999
>
>If we try to insert a new record below :
>YearNum=1999, PeriodNum=2, StartDate=15-Jan-1999, EndDate=15-Feb-1999
>
>The program must give an error.
>
>What is the easiest way to control it? Can we use the validation rule to control this and how?
>
>Thank you very much in advance.

My first suggestion would be to migrate the data to a VFP database. Other than that, if your table is large you're going to have a serious speed problem. If I understand your question you are going to have to check every record in the table before an insert, with ODBC it will crawl. Anyway, you can write a procedure to scan the table and check to see if either of the the two new dates fall between any existing pair of dates and return .T. if they do not, then do the insert. If your table were to belong to a VFP .dbc, then you could use a stored procedure that is called in the record rule validation trigger. HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform