G
Guest
Hi, I've been trying to create a formula for validation and it hasn't been
working (hence, my post). The form is for requesting loaner laptops, and
since it takes time to prepare a laptop for a user, I need to validate the
entry in the DateRequired field.
The idea is that 2 business days of warning is required. Therefore, if the
DateRequired ends up on a Monday or Tuesday, it makes sure that the user has
requested it at least 4 days prior (to account for Sat and Sun). Otherwise,
if the DateRequired ends up on Wed, Thurs, or Fri, it just makes sure it was
requested at least 2 days prior. If the DateRequired ends up on Sat or Sun,
I want to create a separate error message, but that's a separate question
that I'll ask later.
In the meantime, this code that I've been pasting comes back with an invalid
formula error, and I can't see why. [DateRequired] is the name of the very
same entry field I'm trying to validate (I'm pretty sure that's perfectly
OK). I've double checked the parentheses, I've used the functions from the
function query button, etc, etc. Can someone please tell me?
((Weekday( [DateRequired] ) = 2 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 4))
Or
((Weekday( [DateRequired] ) = 3 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 4))
Or
((Weekday( [DateRequired] ) <> 1 ) And
(Weekday( [DateRequired] ) <> 2 ) And
(Weekday( [DateRequired] ) <> 3 ) And
(Weekday( [DateRequired] ) <> 7 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 2))
The OTHER question I have, if you've got the time, is: is it possible to
MsgBox more than one error message from the same field, depending on the type
of error (ie. You can't request a laptop on the weekend. VS. Laptop requests
must be made at least 2 business days in advance.)?
I guess this is just because I don't quite understand the format of the
validation function. I think it's a Visual Basic for Applications formatted
boolean statement, is it not?
Thanks for reading this far!!!!
Spencer
working (hence, my post). The form is for requesting loaner laptops, and
since it takes time to prepare a laptop for a user, I need to validate the
entry in the DateRequired field.
The idea is that 2 business days of warning is required. Therefore, if the
DateRequired ends up on a Monday or Tuesday, it makes sure that the user has
requested it at least 4 days prior (to account for Sat and Sun). Otherwise,
if the DateRequired ends up on Wed, Thurs, or Fri, it just makes sure it was
requested at least 2 days prior. If the DateRequired ends up on Sat or Sun,
I want to create a separate error message, but that's a separate question
that I'll ask later.
In the meantime, this code that I've been pasting comes back with an invalid
formula error, and I can't see why. [DateRequired] is the name of the very
same entry field I'm trying to validate (I'm pretty sure that's perfectly
OK). I've double checked the parentheses, I've used the functions from the
function query button, etc, etc. Can someone please tell me?
((Weekday( [DateRequired] ) = 2 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 4))
Or
((Weekday( [DateRequired] ) = 3 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 4))
Or
((Weekday( [DateRequired] ) <> 1 ) And
(Weekday( [DateRequired] ) <> 2 ) And
(Weekday( [DateRequired] ) <> 3 ) And
(Weekday( [DateRequired] ) <> 7 ) And
((DateValue( [DateRequired] ) - DateValue( Now() ) ) >= 2))
The OTHER question I have, if you've got the time, is: is it possible to
MsgBox more than one error message from the same field, depending on the type
of error (ie. You can't request a laptop on the weekend. VS. Laptop requests
must be made at least 2 business days in advance.)?
I guess this is just because I don't quite understand the format of the
validation function. I think it's a Visual Basic for Applications formatted
boolean statement, is it not?
Thanks for reading this far!!!!
Spencer