0

I have a form has to (maskedbox1) and (maskedbox2)
if maskedbox1 I put date of today, I want (maskedbox2) show date after 30 days as defult
I will be thank you if you help me to do this
I use vb6

3
Contributors
4
Replies
7
Views
9 Years
Discussion Span
Last Post by selvaganapathy
0

To calculate after 30 days you can use DateAdd() function

Example

Draw two MaskEdit Controls and One Command Button

Private Sub Command1_Click()
   Dim FormatDate As String
   Dim DateAfter30Days  As Date
   
   DateAfter30Days = CDate(MaskEdBox1.Text)
   DateAfter30Days = DateAdd("d", 30, DateAfter30Days)
   FormatDate = Format(DateAfter30Days, "dd/MM/yy")
   MaskEdBox2.Text = FormatDate

End Sub

Private Sub Form_Load()
   MaskEdBox1.Mask = "##/##/##"
   MaskEdBox2.Mask = "##/##/##"
   MaskEdBox1.Text = Format(Date, "dd/MM/yy")
End Sub
0

selvaganapathy was given great code...
also you can try use DateSerial()
DateSerial(Year,Month,Day)
This will add 20 days from 5 July 2008.

Private Sub Form_Load()
MsgBox DateSerial(2008, 7, 5 + 20)
End Sub

Result : 7/25/2008

This will count the 50 days from 1 July 2008.

Private Sub Form_Load()
MsgBox DateSerial(2008, 7, 50)
End Sub

Result : 8/19/2008

0

Thank Mr. selvaganapathy
I have another quition:
can I use paper A5 with datereport?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.