Question : date input as string

The clients are storing their fields as strings but i need to do a date comparison.

the first part of the test works but that could just be luck because the string value is less than the other supposedly date value.

how do i correctly do the comparison. in this client the client strings show year only "2004" and my values are full date as a string. "01/02/2008".

you can see what i am trying to achieve here, if the years are in range of each other then add to the counter.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
'*********************************************************************
    '*     Test 4
    '*********************************************************************
     If (Year(CWIntroDate) > Year(ClientIntroDate)) Then
    ' And (Year(CWIntroDate) < Year(ClientTermDate))
        Counter = Counter + 1
  
    End If
    If ((CDate(Year(CWIntroDate))) < CDate(Year(ClientTermDate))) Then
    ' And
        Counter = Counter + 1
  
    End If

Answer : date input as string

try like:

if Val(clientDateString) = Year(yourDateValue) then
     'same
else
     'different
end if
Random Solutions  
 
programming4us programming4us