Another date validation question.

stevey03

New Member
Joined
Nov 28, 2003
Messages
25
I've created a field that calculates a date using todays date as a basis. This works fine using =DateAdd("m",1,Now())+IIf(Weekday(DateAdd("m",1,Now()),2)=6,2,IIf(Weekday(DateAdd("m",1,Now()),2)=7,1,0))

I know want to validate the same field so that it will reject any date in this field that is 3 months after the date that i did the now() function on. It would help if now() was reffered to as date borrowed.

The basics are that the system is for a library and that it automatically inserts the date a book is due for return, but you can modify it as a renewal but only twice more. If anyone can help me or post any suggestions It will probably help me to work this out.

Stevey03
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I'm assuming that the DateBorrowed field has a Default value of =Now() or =Date(). If so, you could create a new field in a query (or form) with the validation string:
=Between [DateBorrowed] And DateAdd("m",3,[DateBorrowed])

Denis
 
Upvote 0
That would work, but i'm sure there is a way of doing it within the table itself. I might do it that way if nobody else can suggest how. Thanks for the suggestion.
 
Upvote 0
You can do it in the table without a query, but a form linked to the table is still the best way to acheive it. Reasons include: You can provide subforms to view related data. You can use a range of built-in validation features on the form. You can lay out the fields so they are easier to use. You'll have less scrolling left and right. You can create macros to jump you to related records on another form. And more.

Check out "validate form" in the Help, see if it gets you anywhere.

Denis
 
Upvote 0
I've sorted it. Thank you very much. I was trying to set it to table but now i know what you were saying. I've done it to the form now. Thanks again.
(y)
 
Upvote 0

Forum statistics

Threads
1,221,586
Messages
6,160,646
Members
451,661
Latest member
hamdan17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top