how to set a default path when you click on browse button?

G

Guest

hi
i've made a database for temporary id cards,
to add photos i've made a command button - when i click on this button i
want it to take me to a specific folder where i store my photos!! please
help...
below given is the coding which i use for this button's on enter event..

Private Sub AddPicture_Enter()
getFileName
End Sub

Sub getFileName()
Dim fileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)


.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "JPEGs", "*.jpg"
.FilterIndex = 3
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path


result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![ImagePath].Visible = True
Me![ImagePath].SetFocus
Me![ImagePath].Text = fileName
End If
End With
End Sub
 
G

Guest

Hi Sham_on_air,

Replace the following line:
..InitialFileName = CurrentProject.path

with one that points to the correct path (or picks the path up from a
settings table or similar) like this:

..InitialFileName = "c:\photos\"

Hope this helps.

Damian.
 

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

Similar Threads


Top