Function Finddoc()
Dim MySize
'' check to see if file exists
MySize = FileLen("C:\vehicle database\Ole_Docs\Comments for unit " & [Forms]![mainform]![newUnitNumber] & ".rtf"
If MySize = 0 Then
'' directory doesn't exist
DoCmd.RunMacro "worddocs"
'' run macro to create word doc from report
Else
Dim WordObj As Word.Application
' Start Microsoft Word and open the document.
Set WordObj = CreateObject("Word.Application"
WordObj.Documents.Open (Forms![mainform]![commentsfile])
WordObj.Visible = True
Const wdWindowStateMaximize = 1
Set WordObj = Nothing
End If
End Function
Dim MySize
'' check to see if file exists
MySize = FileLen("C:\vehicle database\Ole_Docs\Comments for unit " & [Forms]![mainform]![newUnitNumber] & ".rtf"
If MySize = 0 Then
'' directory doesn't exist
DoCmd.RunMacro "worddocs"
'' run macro to create word doc from report
Else
Dim WordObj As Word.Application
' Start Microsoft Word and open the document.
Set WordObj = CreateObject("Word.Application"
WordObj.Documents.Open (Forms![mainform]![commentsfile])
WordObj.Visible = True
Const wdWindowStateMaximize = 1
Set WordObj = Nothing
End If
End Function