I created a form for a database that included a textbox with an event handler (on_click). When the user clicks in the field on the form, it launches the Windows file select dialog box. When the user makes their selection, that value is stored in the database as the path to the target photo.
I recently split the database and distributed the front end. When the database was "whole" on the on the network, the file selector worked perfectly when I tested it. I gave it to another employee in my office and when I went to demonstrate the file picker, he got an error message that said he could not modify this field. I then went back to my desk, and when I tried to modify, I did not get the error message but field value remained blank. The message box confirmation shows that the module is grabbing the file path, but is not modifying the field.
I have included the code, but if someone more learned than me thinks its a folder permission issue, then let me know. I may need to check to make sure that everyone has read/write permissions on the folder. Thanks for your consideration!
Private Sub Photo_Click()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
With fd
.AllowMultiSelect = False
.Title = "Browse to Select a File"
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
MsgBox "Selected item's path: " & vrtSelectedItem
PhotoPath = vrtSelectedItem
Next
End If
End With
Set fd = Nothing
End Sub
I recently split the database and distributed the front end. When the database was "whole" on the on the network, the file selector worked perfectly when I tested it. I gave it to another employee in my office and when I went to demonstrate the file picker, he got an error message that said he could not modify this field. I then went back to my desk, and when I tried to modify, I did not get the error message but field value remained blank. The message box confirmation shows that the module is grabbing the file path, but is not modifying the field.
I have included the code, but if someone more learned than me thinks its a folder permission issue, then let me know. I may need to check to make sure that everyone has read/write permissions on the folder. Thanks for your consideration!
Private Sub Photo_Click()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
With fd
.AllowMultiSelect = False
.Title = "Browse to Select a File"
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
MsgBox "Selected item's path: " & vrtSelectedItem
PhotoPath = vrtSelectedItem
Next
End If
End With
Set fd = Nothing
End Sub