I have a form with a button (Code below) that allows people to add a link to a attachment which is stored on our server.
Problem is people are not the brightest and tend to link to files that are on their desktop (so no one else can open them)
How can i change the code below so it checks the filepath is correct before allowing them to create the link ?
The file should always be placed in the "\\Retail" folder
So is it possible to insert a Left Function in the below ? to check
if so, where would i put this without upsetting the For statement ?
Problem is people are not the brightest and tend to link to files that are on their desktop (so no one else can open them)
How can i change the code below so it checks the filepath is correct before allowing them to create the link ?
The file should always be placed in the "\\Retail" folder
So is it possible to insert a Left Function in the below ? to check
Code:
if (Left(filepath,4) <>"\\Re"
Code:
Private Sub btnAdd_Click()
Dim f As Object
Dim i As Integer
Dim TimeNow As Date
Set f = Application.FileDialog(3)
f.InitialFileName = "\\retail\"
f.AllowMultiSelect = True
f.Filters.Clear
f.Filters.Add "Attachment", "*.msg,*.jpg;*.jpeg;*.gif;*.bmp;*.png;*.tif;*.doc;*.docx;*.xls;*.xlsx;*.pdf;*.mp4,*.mov"
f.show
For i = 1 To f.selecteditems.Count
WaitOn "Adding " & i & " of " & f.selecteditems.Count
CurrentDb.Execute "INSERT INTO tblQCfiles ( Job_ID, Date_Added, File_Location ) " & _
"SELECT " & Forms!frmmain.tbJobID & ", Now(), '" & f.selecteditems(i) & "' AS Expr1;"
TimeNow = Time
Do While Time < DateAdd("s", 1, TimeNow)
DoEvents
Loop
Next i
Me.Requery
Waitoff
End Sub