-
I have two maskeditboxes side by side with a mask of ##/##/##
I have the following code behind a command button
Dim StartDay As String
Dim Endday As String
'fill variables
StartDay = effdate.Text
Endday = expdate.Text
Endday = DateAdd("y", 365, StartDay)
When I click the button nothing happens...This may be due to they are maskeditboxes but im not sure please help...
-
At first: the maskeditbox from microsoft don't work correctly
Correct Code
dim StartDay as date,EndDay as date
startday=cdate(effdate.text)
endday=dateadd("y",1,startday)
expdate.text=endday
-
I get an error message invalid property value on
expdate.Text = EndDay
-
i found the error
expdate.text=format(endday,UserFormat)
UserFormat is the same format then the format of the MaskEdit- Control
example: MaskEdit Format dd.mm.yyyy then Userformat dd.mm.yyyy
all ok
-
Did you try it? It still doesnt put it one year ahead...10/10/00 goes to 10/11/01 I cant figure out why
-
what date should be in the second MaskEditbox ??
The last day of this year or your start date + one year ??
-
Start date plus one year...Its almost doing it..but it is usally one day later then the correct one
like i enter 10/10/00
and then the second box shows 10/11/01
need it to be 10/10/01
-
Answer
then make EndDay=EndDay-1