jessiejane
Programmer
I am getting an error: Type mismatch CDate
I have a text file and when the records in the text files complete 60 days then it writes to a file else puts in a seperate array. I get type mismatch error at CDate.
I am not knowing where its going wrong. Any help is appreciated.
The text file in format:
JOHN-03/04/2010
MARY-07/10/2010
------------------
Code
-------------------
strData = objFSO.OpenTextFile(strDirectory & strFile, strReadingValue).ReadAll
arrLines = Split(strData,vbCrLf)
i=0
For Each strLine in arrLines
Dim x
x = len(strLine)
strDate = Mid(strLine,instr(strLine, "-")+1)
PDate = Cdate(strDate)
todayDate = Date
NumOfDays = DateDiff("d", PDate, todayDate)
if NumOfDays >=60 then
objText.WriteLine(strLine)
Else
Redim Preserve arrInterArray(lineNumber)
arrInterArray(i) = strLine
i=i+1
End If
Next
I have a text file and when the records in the text files complete 60 days then it writes to a file else puts in a seperate array. I get type mismatch error at CDate.
I am not knowing where its going wrong. Any help is appreciated.
The text file in format:
JOHN-03/04/2010
MARY-07/10/2010
------------------
Code
-------------------
strData = objFSO.OpenTextFile(strDirectory & strFile, strReadingValue).ReadAll
arrLines = Split(strData,vbCrLf)
i=0
For Each strLine in arrLines
Dim x
x = len(strLine)
strDate = Mid(strLine,instr(strLine, "-")+1)
PDate = Cdate(strDate)
todayDate = Date
NumOfDays = DateDiff("d", PDate, todayDate)
if NumOfDays >=60 then
objText.WriteLine(strLine)
Else
Redim Preserve arrInterArray(lineNumber)
arrInterArray(i) = strLine
i=i+1
End If
Next