Hi all,
I need to brows for a file on the network then attach the PDF into a Table
All works well, the correct folder is opened, I can select the PDF file, until it needs to attached die file name into my Table, then I get the error
Not sure If I am missing something here, please could you advise
I need to brows for a file on the network then attach the PDF into a Table
All works well, the correct folder is opened, I can select the PDF file, until it needs to attached die file name into my Table, then I get the error
Not sure If I am missing something here, please could you advise
Public Function BrowseFile() As String
Dim strFile As String
With Application.FileDialog(1)
.Title = "Select File"
'.InitialFileName = "\\Sjo2054\shared\CAMO\DAW Sheet\Data Files\Attachments\"
If .Show Then
strFile = .SelectedItems(1)
Else
MsgBox "No file selected", vbInformation
Exit Function
End If
End With
BrowseFile = strFile
End Function
Private Sub cmdBrowse_Click()
On Error GoTo Err_Handler
Dim Attachment As String
Dim strFolder As String
Dim strFile As String
Dim intPos As Integer
Attachment = BrowseFile
If Attachment <> "" Then
' get folder and file names
'intPos = InStrRev(Attachment, "\\Sjo2054\shared\DAW Sheet\Data Files\Attachments Temp File\")
strFolder = left(Attachment, intPos - 1)
strFile = Mid(Attachment, intPos + 1)
' populate text boxes on form
Me.Attachment = Attachment
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Sub