Are you telling me there is no function or an expression that I can put inside the SQL statement that adds another calculated field that say, converts the date into YYYYMMDD and puts it in a column as part of the query, but not to be saved as a new field in the table, so I can use it simply to select the date range? I am looking for something in this context:
SELECT ITEM, DATE, DEPTH, COMMENT, SORTDATE(DATE) as SRT_DATE FROM MyTable WHERE SRT_DATE >= StartDate.text and SRT_DATE <= EndDate.text
Here SORTDATE would be a function that converts the DATE from M/DD/YYY to YYYYMMDD as shown BELOW:
SUB SORTDATE(DATE as string)
Dim MyDate,MyDate2, M, D, Y ,SortDate As String
M=MyDate.SubString2(0,MyDate.IndexOf("/")) 'returns 1 in 1/10/2012
MyDate2=MyDate.Substring(M.Length+1) 'returns 10/2011 in 1/10/2012
D=MyDate2.SubString2(0,MyDate2.IndexOf("/")) 'returns 10 in 1/10/2012
Y=MyDate.SubString(MyDate.Length-4) 'returns the year 4 digits 2012 in 1/10/2012
If M.Length=1 Then
M="0" & M 'to make it 2 digits month
End If
If D.Length=1 Then
D="0" & D 'to make it 2 digits day
End If
SORTDATE =Y&M&D
END SUB