How do I add a filename to database using browse?

R

rlpmaverick

(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.
 
A

Anthos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top