I am totally lost. Our IT staff will no longer support Microsoft Access. We were working in Access 2010 and now we have been upgraded to Microsoft Access 2016. Surprisingly, our data base still works except when we try to run the following module. Can anyone help us re-write the module included in this post. We keep getting a 91 error code. We have to keep this database running until we get a replacement database. I apologize if I am posting this incorrectly and I am open to guidance on how or where to post for help. We know it has something to do with Application.File search and our End With Syntax.
With Application.FileSearch
.NewSearch
.LookIn = pubPermitDocFolder 'a constant in GenMods module
.SearchSubFolders = False
.FileName = finddoc
.MatchTextExactly = True
.FileType = msoFileTypeWordDocuments
If .Execute() > 0 Then
pubCopyPermitDoc = finddoc
Else
pubCopyPermitDoc = Null
MsgBox ("An electronic version of the permit conditions is not available." & CR & "Please see your supervisor about creating one, or using an" & CR & "existing inspection format.")
Exit Sub
End If
End With
DoTheMerge:
Call dmerge(WordDoc, MergeQuery, SaveFolder)
Exit Sub
dfLettersPInspError:
MsgBox ("error # " & Err.Number & Err.Description)
Resume Next
End Sub
With Application.FileSearch
.NewSearch
.LookIn = pubPermitDocFolder 'a constant in GenMods module
.SearchSubFolders = False
.FileName = finddoc
.MatchTextExactly = True
.FileType = msoFileTypeWordDocuments
If .Execute() > 0 Then
pubCopyPermitDoc = finddoc
Else
pubCopyPermitDoc = Null
MsgBox ("An electronic version of the permit conditions is not available." & CR & "Please see your supervisor about creating one, or using an" & CR & "existing inspection format.")
Exit Sub
End If
End With
DoTheMerge:
Call dmerge(WordDoc, MergeQuery, SaveFolder)
Exit Sub
dfLettersPInspError:
MsgBox ("error # " & Err.Number & Err.Description)
Resume Next
End Sub