Hi,
I have a button named View Orders in a form, the cmdViewOrders will open the SharePoint folder which is associate with the case#. The Path is C:\Users\" & Environ("UserName") & "\SharePoint\CasesDoc\" & Folder\& "\" & SPCaseName
for example: C"\Users\Mary.Smith\SharePoint\CasesDoc\A-F\Doe, John vs. Jones, Jenny_C12345678 -- > this is the path will be open when user(s) on the case C12345678 and click the View Orders in this case
I would like to do is if there is no such case (Doe, John vs. Jones, Jenny_C12345678 in the A-F folder (the Folder is base on the Plaintiff's first letter of the last name).
My problem here is the cmdViewOrders shows on every case, it seems not checking on the Path. Both are either cmdViewOrders visible or the cmdViewOrders invisible on all cases no matter if the case is exist in the folder or not.
Any help will be great appreciate!
Thank you
I have a button named View Orders in a form, the cmdViewOrders will open the SharePoint folder which is associate with the case#. The Path is C:\Users\" & Environ("UserName") & "\SharePoint\CasesDoc\" & Folder\& "\" & SPCaseName
for example: C"\Users\Mary.Smith\SharePoint\CasesDoc\A-F\Doe, John vs. Jones, Jenny_C12345678 -- > this is the path will be open when user(s) on the case C12345678 and click the View Orders in this case
I would like to do is if there is no such case (Doe, John vs. Jones, Jenny_C12345678 in the A-F folder (the Folder is base on the Plaintiff's first letter of the last name).
Code:
Below is my code in the Form_Current()
Dim MyPath As String
Dim NameLetter As String
Dim Folder As String
Dim PLLetter As String
Dim CaseName As String
Dim db As Database
Dim rs As RecordSet
Dim db = CurrentDb
Set rs = db.OpenRecordSet("Select CLName, PLName from qrySharPointNameList Where CLCASENUM = " & Chr(34) & Me.CLCASENUM & Chr(34), dbOpenDynaset, dbSeeChanges)
CaseName = rs!PLName & " vs. " & rs!CLName
rs.Close
PLLetter = Left([CaseName],1)
NameLetter = PLLetter
SPCaseName = CaseName & "_" & Me.CLCASENUM
Select Case True
Case NameLetter >="A" And NameLetter <="F"
Folder = "A-F"
Case NameLetter >="G" And NameLetter <="L"
Folder = "G-L"
Case NameLetter >="M" And NameLetter <="R"
Folder = "M-R"
Case NameLetter >="S" And NameLetter <="X"
Folder = "S-X"
Case NameLetter >="Y" And NameLetter <="Z"
Folder = "Y-Z"
End Select
I tried:
MyPath = "C:\Users\" & Environ("UserName") & "\SharePoint\CaseDoc\" & Folder & "\" & SPCaseName
If Dir(MyPath) <> " " then
cmdViewOrders.visible = True
Else
cmdViewOrders.visible = false
End if
I also tried:
MyPath = Dir("C:\Users\" & Environ("UserName") & "\SharePoint\CaseDoc\" & Folder & "\" & SPCaseName)
If (MyPath) <> " " then
cmdViewOrders.visible = True
Else
cmdViewOrders.visible = false
End if
My problem here is the cmdViewOrders shows on every case, it seems not checking on the Path. Both are either cmdViewOrders visible or the cmdViewOrders invisible on all cases no matter if the case is exist in the folder or not.
Any help will be great appreciate!
Thank you