Hi,
I have a Button named btnViewOrders in a frmOrder that is visible base on if there any document(s) associate with the OrderDate and OrderNo of the record. We used to saved those documents as PDF format in a network drive (Z drive). below is my code that works fine when the documents are save in the Z drive:
(in the Z drive, I have a folder named Orders, inside the Order folder I have a Current Year sub folder, inside the current year folder, I have date folders)
But now, we want to move these documents from the Network drive (Z) to SharePoint. I changed the path to:
**sharepoint address - - > it's the https (for some reason it's not allow me to type the link)
the problem is the If statement is not doing what it suppose to do and the btnViewOrders shows on all records. It seems doesn't check on the parameters. I couldn't figure out what I missed. I know "Dir" is for the system file, but since the SharePoint is not a system file so I can't use "Dir", does anyone know what I should use for the hyperlink to make it works or any better suggestion?
Thank you for your time
I have a Button named btnViewOrders in a frmOrder that is visible base on if there any document(s) associate with the OrderDate and OrderNo of the record. We used to saved those documents as PDF format in a network drive (Z drive). below is my code that works fine when the documents are save in the Z drive:
(in the Z drive, I have a folder named Orders, inside the Order folder I have a Current Year sub folder, inside the current year folder, I have date folders)
Code:
FormCurrent
Dim Holddate as string
Dim HoldYear as string
Dim stFileName as String
Holddate = Format(Me.Orderdate,"mm") & "-" & Format(Me.Orderdate,"dd") & "-" & format(Me.Orderdate, 'yy")
HoldYear = format(Me.Orderdate, "yyyy")
stFileName = Dir("Z:\Orders\" & HoldYear & "\" & Holddate & "\" & Me.OrderNo & "*pdf")
If Isnull(stFileName) or stFileName = "" then
btnViewOrders.visible = False
Else
btnViewOrders.visible = True
End if
But now, we want to move these documents from the Network drive (Z) to SharePoint. I changed the path to:
Code:
stFileName = "sharepointaddress/documents/Orders/" & HoldYear & "/" & Holddate & "/" & Me.OrderNo & "*.pdf"
**sharepoint address - - > it's the https (for some reason it's not allow me to type the link)
the problem is the If statement is not doing what it suppose to do and the btnViewOrders shows on all records. It seems doesn't check on the parameters. I couldn't figure out what I missed. I know "Dir" is for the system file, but since the SharePoint is not a system file so I can't use "Dir", does anyone know what I should use for the hyperlink to make it works or any better suggestion?
Thank you for your time
Code:
Last edited: