My Assistant
![]() ![]() |
|
|
Oct 8 2007, 04:25 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 64 From: Chicago, Illinois |
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 |
|
|
|
Oct 8 2007, 04:51 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 13,031 From: Leicester, UK |
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? |
|
|
|
Oct 8 2007, 05:52 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 64 From: Chicago, Illinois |
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" |
|
|
|
Oct 8 2007, 06:45 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 6,898 From: Earth... |
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, |
|
|
|
Oct 9 2007, 03:13 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 13,031 From: Leicester, UK |
are you trying to use the current year when you put "yyyy"? if so then use year(now())
|
|
|
|
Oct 9 2007, 01:06 PM
Post
#6
|
|
|
UtterAccess Enthusiast Posts: 64 From: Chicago, Illinois |
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!
|
|
|
|
Oct 9 2007, 01:48 PM
Post
#7
|
|
|
UtterAccess VIP Posts: 13,031 From: Leicester, UK |
you're welcome
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 24th May 2013 - 08:23 AM |