fpas1971
Oct 8 2007, 04:25 PM
Hello- In my database I have a calendar that is tied to a control box. I am requesting that the end users open the calendar and select a future date (Dates that are 2008 and greater). If the end user provides a current or previous year they should be prompted to provide me with a future year. Also, I do not want to actually enter 2008 in the expression. Rather, I want to use the current system date and compare any end user response to the system date. This will prevent me from having to go behind the scenes every year and manually change the date to reflect the new year.
I was using an If/Then statement on my form. However no matter what year I select I get the the message asking me to change my effective date
If ProjectedSignDt <= "yyyy" Then
MsgBox "Your Projected Effective Date must be after " & ("yyyy") & ". Please Adjust your Date"
ProjectedSignDt = ""
ElseIf ProjectedSignDt > "yyyy" Then
MsgBox "Thank You"
Endif
dannyseager
Oct 8 2007, 04:51 PM
Your code is not right.... you are saying "If ProjectedSignDT <=YYYY" (i.e. you're actually saying YYYY.
Is YYYY a variable that you have populated else where?
fpas1971
Oct 8 2007, 05:52 PM
Yep sorry about that- I edited it incorrectly prior to posting.
If ProjectedSignDt <= "yyyy" Then
MsgBox "Your Projected Effective Date must be after " & ("yyyy") & ". Please Adjust your Date"
ProjectedSignDt = ""
ElseIf ProjectedSignDt > "yyyy" Then
MsgBox "Thank You"
Aquadevel
Oct 8 2007, 06:45 PM
fpas1971,
You are still 'looking' for ......'YYYY' and not a <real> year, that I can see anyway.
Where you have the 'YYYY' should be a text control on the form.
Something like:
If ProjectedSignDt <= Me.[CheckYear] Then
MsgBox "Your Projected Effective Date must be after " & Me.[CheckYear] & ". Please Adjust your Date"
ProjectedSignDt = ""
ElseIf ProjectedSignDt > Me.[CheckYear] Then
MsgBox "Thank You"
Good luck,
dannyseager
Oct 9 2007, 03:13 AM
are you trying to use the current year when you put "yyyy"? if so then use year(now())
fpas1971
Oct 9 2007, 01:06 PM
Thanks Danny- your code for pulling the current year was what I needed. For some reason I thought YYYY was going to give me the current year but your code works. I am now able to prevent the end user from selecting the current year when a future year is needed. Thanks!
dannyseager
Oct 9 2007, 01:48 PM
you're welcome
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.