Hi all,
I have a mock attachments field on my form. In basic terms, the user can drag/drop a file to 'attach it', access saves the file into a folder generated by that record and the listbox is updated with a hyperlink to that newly saved file.
Works great, unless there is a comma in the file name. As you can see in the images I've attached, if I rename the file to "testing, file name" I get the results "testing" which creates a broken hyperlink and throws an error when you try to open it.
I've not entirely sure how to fix this. Any ideas?
Code:
Private Sub btRefreshList_Click()
Dim sFolder As String
Dim sBackEnd As String
Dim FileName As String
sBackEnd = Left(FGetBackEndPath, InStrRev(FGetBackEndPath, "\") - 1)
sFolder = sBackEnd & sAttachmentFolderName & "\" & Order & "\"
Me.cboAttachments.RowSource = ""
FileName = Dir(sFolder, vbNormal)
Do While Len(FileName) > 0
Me.cboAttachments.AddItem FileName
FileName = Dir()
Loop
End Sub