I am using the DTP tool in VB Express Edition 2005. What I am trying to do is when a user selects a date in the past, for instance December 1, 2007, using the DTP the code will add 45 days to that date and if todays date is <= 12/1/2007 + 45 then it returns a certain form. If it is > 12/1/2007 + 45 then it returns a different form. I should add that I am trying to convert VB that currently does this in an old 2003 version Excel wookbook to a stand alone VB application. Any and all suggestions are welcomes and appreciated.
Old Excel VB Code that I wrote that worked:
CODE
Private Sub cmdbDBAOk_Click
Dim dtNowDate As Date
Dim dtDTP As Date
Dim dtDate45 As Date
dtNowDate = Now() "Today's Date"
dtDTP = DTPDBA.Value "This line is the value that the user selects from the DTP"
dtDate45 = dtDTP + 45 "This line adds the 45 days"
If dtNowDate . dtDate45 Then
Me.Hide
frmPastDBADate.Show
End If
If dtNowDate <= dtDate45 Then
Me. Hide
frmEligDBA.Show
End If
End Sub
Since the NOW() function is not available in VB Express this is the code that I have been trying unsuccessfully:
CODE
Public Class frmFileDBA
Private Sub cmdbDBAOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdbDBAOk.Click
Dim dtNowDate As Date
Dim dtDTP As Date
Dim dtDate45 As Date
Dim intDays As Integer
dtNowDate = Today
dtDTP = dtpDBA.Value
intDays = 45
dtDate45 = dtDTP + intDays
If dtNowDate > dtDate45 Then
Me.Hide()
frmPastDBADate.Show()
End If
If dtNowDate <= dtDate45 Then
Me.Hide()
frmEligDBA.Show()
End If
End Sub
End Class
The error that I am getting is "Operator '+' is not defined for types 'Date' and 'Integer' Thanks in advance for your assistance.