Private Sub Ticket_DblClick(Cancel As Integer)


    'Opens newtwork folder specific to the MAM Ticket Number if there is one set up

    Open_Specific_Folder_MAM

    

End Sub


Private Sub Open_Specific_Folder()

'Opens specific ticket folders if set up (NOT MAM)

    

On Error GoTo PROC_ERR                'On error go to


       'Declare Variables

        Dim StrYear As String

        Dim StrMonth As String

        

        StrYear = Year(StartDate())            'Gets the Year from the form field StartDate

        StrMonth = Month(StartDate())    'Gets the Month from the form field StartDate 


       

        'Opens up the folder path C:\New Folder\Jobs\Info + YEAR + MONTH + ID

        'YEAR & MONTH StrValues ID = Form Field

        strMyDocPath = "C:\New Folder\Jobs\Info" & "\" & StrYear & "\" & StrMonth & "\" & ID 'Create the path

          

        FollowHyperlink strMyDocPath        'Opens up the path set by the variable strMyDocPath 

        Caption = strMyDocPath

        Exit Sub


PROC_ERR:

    

'Tells the user that there is no folder setup, and would they like to create one. If NO exit sub, if YES then creates one, and then opens it

    

    Dim StrResponse As Integer

    

    StrResponse = MsgBox(" Sorry no folder set up against job no:-  " & ID & " Would you like to create one for it ", vbYesNo + vbQuestion)

    

    If StrResponse = vbNo Then

        MsgBox "Ok", vbInformation

        Exit Sub

        End If

        

    If StrResponse = vbYes Then

        MkDir "W:\Facilities\00-Jobs\01-Ticket Info" & "\" & StrYear & "\" & StrMonth & "\" & ID

        MsgBox "Created", vbInformation

        strMyDocPath = "W:\Facilities\00-Jobs\01-Ticket Info" & "\" & StrYear & "\" & StrMonth & "\" & ID

        FollowHyperlink strMyDocPath

        End If

    

'Help

    'https://stackoverflow.com/questions/3244354/how-to-get-the-current-year-using-vba

    'MsgBox " Sorry no folder set up against job no,would you like to create one " & "-" & " " & ID, vbInformation

    'MsgBox " Sorry no folder set up against job no " & "-" & " " & ID, vbInformation

    'MsgBox "Error " & Err.Number & " No folder set up against job no " & "-" & " " & ID, vbInformation

    'MsgBox "Error: (" & Err.Number & ") " & Err.Description, vbCritical

    'https://www.techonthenet.com/access/constants/msgbox_ret.php

    'https://www.fmsinc.com/tpapers/vbacode/debug.asp

    'https://www.mrexcel.com/board/threads/msgbox-with-vbyesno-and-vbcritical.625721/

    

Exit Sub