Why am I getting an error for the following:
[code] sr = NthField(DateTaken,":",1)
nm = Val(sr)
sqDate.Year = nm[/code]
Thank you.
Why am I getting an error for the following:
[code] sr = NthField(DateTaken,":",1)
nm = Val(sr)
sqDate.Year = nm[/code]
Thank you.
what error are you getting? Did you dimed nm?
Error: An exception of class NilObjectException was not handled. The application must shut down.
The value of sr and nm is ‘2014’. I’ve tried using Ctype with no success.
It’s hard to tell from such a tiny snippet of code. But my guess, given the error message, is that you never created an instance of sqDate before using it.
Dim sqDate As New Date
Yes I did Dim sqDate. Here’s more code:
[code] Dim s as string
Dim i as integer
Dim sh as new shell
Dim cmd as string
Dim x as integer
Dim v(-1) as string
Dim arg as string
Dim valu as string
Dim j as integer
Dim lb As Listbox
Dim found as integer
Dim sqDate As Date
Dim nm As Integer
Dim sr As String
reDim ExifData(-1)
If ExifSupported(GetFolderItem(path)) = False Then Return
DefineExifData
lb = WindowMain.ContainerControlSessionData1.ContainerControlExposureData1.ListboxExifData
lb.DeleteAllRows
'cmd= App.CurrentDirectory + “EXIFtool -s -n “+path
cmd= App.CurrentDirectory + “EXIFtool “+ “””” + path + “”””
'MsgBox(cmd)
sh.execute cmd
s=ReplaceLineEndings(sh.result,EndOfLine)
v=Split(s,EndOfLine.Windows)
'MsgBox(s)
For i=0 to v.Ubound
x=InStr(v(i),":")
arg=Trim(Left(v(i),x-1))
valu=Trim(Mid(v(i),x+1))
If arg = “Create Date” And valu <>"" Then
DateTaken = NthField(valu, " “,1)
MsgBox(NthField(DateTaken,”:",1))
sr = NthField(DateTaken,":",1)
nm = Val(sr)
MsgBox(sr +" - " + Str(nm))[/code]
My assumption was correct. Change the Dim of sqDate to what I posted and it should get you past that error. Date is an object and objects have to be instantiated before using them. This can be done by using the constructor (NEW) are assigning an object that already exists.
Of course! Thank you Randy.