DTPicker

hi,
 How could i do this:
 Q - The backdating can only go back until 1/5/06, subject to not being more than 6 months from today - users requirement.

Thanks
wz


wzmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
Private Sub DTPicker1_Change()
  If DTPicker1.Value < DateAdd("M", -6, Now) Then
    DTPicker1.Value = DateAdd("M", -6, Now)
  End If
End Sub

the user can still scroll to any date, but the selected date will not be before 6 months
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wzmAuthor Commented:
if now = 1/12/2006 - the minimum backdate = 1/6/2006

if now = 1/6/2006 - subjected to 1/5 as the benchmark - = 1/5/2006

if now = 1/12/2008 - minumum = 1/6/2008

0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Private Sub DTPicker1_Change()
  If DTPicker1.Value < DateAdd("M", -6, Now) Then
    DTPicker1.Value = DateAdd("M", -6, Now)
  End If
  if DTPicker1.Value < DateSerial(2006,5,1) then
    DTPicker1.Value = DateSerial(2006,5,1)
  end if
End Sub
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

g_johnsonCommented:
are you saying not more than 6 days ago and not more than 6 months from now, limited by 1/5/06?

If so,

if dtp1.value < dateadd("d",-6,date) then
   dtp1.value = dateadd("d",-6,date)
elseif dtp1.value > dateadd("m",6,date) then
   dtp1.value = dateadd("m",6,date)
end if

if dtp1.value < cdate("01/05/2006") then
    dtp1.value = cdate("01/05/2006")
endif

does that do it?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes, that looks fine
0
wzmAuthor Commented:
" are you saying not more than 6 days ago and not more than 6 months from now, limited by 1/5/06? "

 - 6 days ago = no
 - 6 months ago = yes
 - 6 months from now = no
 - date is equal to current day (default) and cannot allow user to
   move forward, only backward and;
   = minimum(1/5/06,current date - 6 months)
   where the backdating span is within 6 months period.
 (this is for insurance industries practice)

hope that's clear.. hard for me to understand myself. :)

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.