On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.
Public Function GetWordComplaint(strComplaintDoc, Response, GotIt, DocSource) DoCmd.Hourglass True 'pubComplaintDocFolder is a constant located in the GenMods module 'This Function gets an already-existing document, if it is there and if the user wants to use it 'check to see if there is already a document by this name in the Complaint Document Folder 'if not, exit this function 'If so, tell them it exists and find out if they want to replace it with a new one? 'If they don't want to replace it, exit this function; otherwise, make a new document 'If they want to replace it with a new one, open a brand new WordDocument for them according to name criteria Dim FolderSource As String If DocSource = "cmp" Then FolderSource = pubComplaintDocFolder Else FolderSource = pubInspDocFolder End If With Application.FileSearch .NewSearch .LookIn = FolderSource .SearchSubFolders = False .FileName = strComplaintDoc .MatchTextExactly = True .FileType = msoFileTypeWordDocuments If .Execute() = 0 Then DoCmd.Hourglass False If Response = "edit" Then GotIt = 1 MsgBox ("Complaint document " & strComplaintDoc & " does not exist in Word. If you need to create one, go to the 'Merge' icon.") End If Exit Function Else 'KeyCode = 0 'ME: 7/11/03 - add code so it knows which control got you in here: new merge or edit If Response <> "edit" Then Response = MsgBox("The Document " & strComplaintDoc & " has previously been merged-Do You Want To MERGE Anyway?", vbYesNo) 'ME: 7/11/03 - take out the following line and exit regardless of response ' we don't need to bring up the existing document from the "Create" button (consistency) 'If response = vbYes Then GoTo Exit_Here GoTo Exit_Here End If End If End With strComplaintDoc = pubComplaintDocFolder & strComplaintDoc Dim wApp As New Word.Application Dim wDoc As Word.Document ' make new Word data file On Error GoTo dMergeError ' open word merge document Set wDoc = wApp.Documents.Open(strComplaintDoc) wApp.Visible = True wApp.WindowState = wdWindowStateMaximize Exit_Here: DoCmd.Hourglass False Exit Function dMergeError: Select Case Err.Number Case 5174 MsgBox ("Word doc named " & strComplaintDoc & " cannot be located.") Case Else MsgBox ("error # " & Err.Number & Err.Description) End Select Resume Exit_Here End Function
Option Compare Database Option Explicit 'following are various global fields for system Public GoodUpdate As Integer Public HoldBookMark As String Public glbProjID As Long Public glbFacChemID As Integer Public HoldRunCnt As Long Public pubCurrDBPath As String Public LastPage As Integer Public PageTop As Integer Public CloseOverride As Integer Public OK2CloseAsbFac01 As Integer Public OK2CloseFacDetail01 As Integer Public OK2CloseFacDetail02 As Integer 'Public Const pubComplaintDocFolder As String = "H:\users\wpdocs\airqual\air_compliance\Complaint\"
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.