Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to open the file dialog and get the directory of the selected path in access 2007.

I know to open the file dialog but I did not know the function that return you the directory I used F.FileName but gives me an error. this is the code that I used:
VB
Dim f    As Object
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.AllowMultiSelect = False
f.Title = "Please Select an Excel Sheet"
f.Filters.Clear
f.Show
txt_Path.Text = f.FileNameToString()//gives me Error how can i fix it

the error is "Object does not support this property or method"
Can any one help me in doing that?
Posted
Updated 9-Feb-11 4:43am
v5
Comments
Sandeep Mewara 9-Feb-11 10:40am    
It would be good if you share the error too. Either post as comment or edit your question to post error.

You probably need to use FileDialog.SelectedItems (even if there is only one selected item).

See http://msdn.microsoft.com/en-us/library/aa432435(v=office.12).aspx[^]
 
Share this answer
 
You would need to loop through the selected file get them one by one

VB
'Loop through each file selected and do whatever you want to do with it.
For Each varFile In .SelectedItems
  'varFile - this is your file name
Next



Souce: http://bytes.com/topic/access/answers/539285-file-dialog[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900