Solved

DTPicker

Posted on 2006-04-20
240 Views
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

0
Question by:wzm

LVL 142

Accepted Solution

Private Sub DTPicker1_Change()
If DTPicker1.Value < DateAdd("M", -6, Now) Then
End If
End Sub

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

Author Comment

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

LVL 142

Expert Comment

Private Sub DTPicker1_Change()
If DTPicker1.Value < DateAdd("M", -6, Now) Then
End If
if DTPicker1.Value < DateSerial(2006,5,1) then
DTPicker1.Value = DateSerial(2006,5,1)
end if
End Sub
0

LVL 4

Assisted Solution

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

If so,

end if

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

does that do it?
0

LVL 142

Expert Comment

yes, that looks fine
0

Author Comment

" 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

Featured Post

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…