ADDDATE and checkbox = true

I have been asked to update this web app however I have never programmed in whatever this is written in, I think  it was copied over from C++
This statement returns all records and sorts by ID

Case "initial Date"
If strSrchType = "Equals" Then ( this is just a drop down select)
 sqlString = "SELECT * FROM TableName WHERE InitialDate=""" & strSrchFor & """ AND InitialDate >= " & strSrchFor & " ORDER BY ID, InitialDate"
End If

what I would like this statement to do is add 5 years to the initial date and return those records greater then today's date that do not have a disqualified checkbox = true

I would sooner not have to enter anything in the strSrchFor field , I would rather just select the search now button that is already there.

initial date is initialDate
disqualified check box is disqualified
name is ID
Wobbs_peiAsked:
Who is Participating?
 
jostranderConnect With a Mentor Commented:
I think you can just change your SQL statement.  Maybe something like this:

SELECT * FROM TableName WHERE disqualified=False AND DATEADD("yyyy",5,InitialDate)>Now() ORDER BY ID, InitialDate
Case "initial Date"
If strSrchType = "Equals" Then
 sqlString = "SELECT * FROM TableName WHERE disqualified=False AND DATEADD(""yyyy"",5,InitialDate)>Now() ORDER BY ID, InitialDate"
End If

Open in new window

0
 
Wobbs_peiAuthor Commented:
I only had to change Date to Getdate
0
All Courses

From novice to tech pro — start learning today.