dgdavidge wrote:
Sub Open()
dim rs As RecordSet, f As FolderItem
rs = app.MainDB.SQLSelect("SELECT * FROM Setups WHERE Name = 'pdfFolder'")
if rs <> nil and rs.RecordCount > 0 Then
PDFPath = rs.Field("Value").StringValue
f = GetFolderItem(PDFPath)
if not f.Exists Then
dim f1 As FolderItem = f.Parent
if not f1.Exists Then
dim f2 As FolderItem = f1.Parent
if not f2.Exists Then f2.CreateAsFolder
f1.CreateAsFolder
Else
f.CreateAsFolder
end if
end if
end if
End Sub
This routine works fine in Win7 but throws an nil object error at the line
This was with 2012R2.1. I rebuilt it with 2011R4.3 and the same thing still happens. The code was originally developed several years ago an an XP machine. The updated program has some features that I'm afraid won't work if I have to go back several years to fix this.
The recordset returns a valid path that exists on the computer. I'm looking for suggestions for a work around.
f = GetFolderItem(PDFPath)
I'd double check this line
It probably just needs to be updated to
f = GetFolderItem(PDFPath,Folderitem.PathTypeAbsolute)