How do I add a filename to database using browse?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

(WinXP Access2003)
I need a simple way to add a command button to a form that will open a
browse window and, upon finding the desired file, put the path and filename
into a field in my database. Any help in this area would be wonderful.
Thanks.
 
Add the following code to your Button.

Private Sub Command0_Click()
Dim strFileName As String
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Show
strFileName = .SelectedItems(1)
End With

Me.FilePathField.value = strFileName

End Sub


This code will require a reference to the Microsoft Office Object
Library (in your case it would be Microsoft Office 11.0 Object
Library)

Hope this Helps

Regards
Anthony
 
Back
Top