Tang
Posts: 14
|
| Posted: 08/06/2004, 8:17 AM |
|
I'm using this function at the location "BeforeExecuteInsert". Is that the right place for this function and is the is my syntax right?
'Validate Minimum Value @53-BD6896EE
If Not CStr(TBL_DEPLOYED.START_DATE.Value) = "" And CDbl(TBL_DEPLOYED.START_DATE.Value) < Now() + 5 Then _
TBL_DEPLOYED.START_DATE.Errors.addError("You can NOT Schedule Last Minute. Earliest Schedule date is FIVE days from today.")
'End Validate Minimum Value
|
 |
 |
DonB
|
| Posted: 08/06/2004, 8:27 AM |
|
Why are you converting the START_DATE to a "Double"? If your database is
Access, then "Now() +5" is OK - that is 5 days in the future.
A date expression like you describe may not give you what you might expect,
if the date is stored with the time "truncated" (actually, set to
00:00:00.000). Now is "now" right to the fraction of a second. So values
from "today" might be excluded because the time is earlier than "now".
--
DonB
logging at http://www.gotodon.com/ccbth, and blogging at http://ccbth.gotodon.net
"Tang" <Tang@forum.codecharge> wrote in message
news:64113a0f440497@news.codecharge.com...
> I'm using this function at the location "BeforeExecuteInsert". Is that the
right
> place for this function and is the is my syntax right?
> 'Validate Minimum Value @53-BD6896EE
> If Not CStr(TBL_DEPLOYED.START_DATE.Value) = "" And
> CDbl(TBL_DEPLOYED.START_DATE.Value) < Now() + 5 Then _
> TBL_DEPLOYED.START_DATE.Errors.addError("You can NOT Schedule Last
> Minute. Earliest Schedule date is FIVE days from today.")
> 'End Validate Minimum Value
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Tang
Posts: 14
|
| Posted: 08/06/2004, 8:47 AM |
|
I didn't intend to convert START_DATE to a double. Is that "CDbl"? If so then what should I change it to? BTW this is the CCS generated code, so I don't know why it would change it to a double.
Yes this is an access DB. As far as I know NO time is stored within this field. I have the type set to "Short Date".
When I do test the page it still allows entries for all dates, so no restrictions are taking place.
|
 |
 |
Tang
Posts: 14
|
| Posted: 08/09/2004, 4:48 AM |
|
BUMP.
I can't imagine why this wouldn't restrict or at least cause some sort of Error. I've tried many combos, placing this "Add Action-Validate Minimum Value" in many different locations within the events tab of the page. I can't restrict and imput, I never even get and error. Here's what the Tab properties look like...
Before Execute Insert
Validate Minimum Value
-------------------------------------
Control Name = START_DATE
Minimun Value = Now() + 5
Error Message = Must be Greater than Five days...
|
 |
 |
Tang
Posts: 14
|
| Posted: 08/09/2004, 4:51 AM |
|
Sorry still asleep.
...can't restrict any input....
...what the Events "Tab" properties
Tang
|
 |
 |