Getting the path of a selected file...?

Y

yesby

Is it possible to...

Create a command button on an Access form that will at runtime show a standard Windows File Open dialog box, and return the full path/file name of a selected file to a text field in the table? I can then use the path information to display picture thumbnails on the form using the ..Picture property of an Image object.

Thanks.
 
D

Dirk Goldgar

yesby said:
Is it possible to...

Create a command button on an Access form that will at runtime show a
standard Windows File Open dialog box, and return the full path/file
name of a selected file to a text field in the table? I can then use
the path information to display picture thumbnails on the form using
the .Picture property of an Image object.

Thanks.

You'll find it at:

www.mvps.org/access/api/api0001.htm
 
Y

yesby

Got that much to work...thanks.
How do I take that string and return it to a text field called "Photo1" in a
table called "MMSB".

Sorry, but I'm very new to Access and just getting the basics down:)
 
D

DBS

These might prove useful:

(If it wraps, put it back.)

http://www.mvps.org/access/api/api0001.htm
API: Call the standard Windows File Open/Save dialog box

Display Open and Save As Dialog Boxes in Access with API Function
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnima01/html/ima1101.asp

Enhance Your Apps with Common Dialogs: Part
http://msdn.microsoft.com/library/d...ry/en-us/dnovba00/html/CommonDialogsPartI.asp

ACC: How to Relink Back-End Tables with Common Dialog Control
http://support.microsoft.com/default.aspx?scid=kb;en-us;181076&Product=acc

Hope that helps!

DBS (David Staas)
 
T

Tony Vrolyk

try the first two functions listed here
http://www.mvps.org/access/api/index.html


Is it possible to...

Create a command button on an Access form that will at runtime show a
standard Windows File Open dialog box, and return the full path/file name
of a selected file to a text field in the table? I can then use the path
information to display picture thumbnails on the form using the .Picture
property of an Image object.

Thanks.
 
D

Dirk Goldgar

yesby said:
Got that much to work...thanks.
How do I take that string and return it to a text field called
"Photo1" in a table called "MMSB".

Sorry, but I'm very new to Access and just getting the basics down:)

If you're doing this in a form that has MMSB as its recordsource, then
it's very simple. Just put a text box bound to the Photo1 field on the
form -- and you can make that text box invisible if you want -- and then
use code along these lines for your command button's Click event:

Private Sub cmdPickFile_Click()

Me.Photo1 = GetOpenFile()

End Sub

That assumes that you've modified the demonstration function in that
module so that it behaves the way you want.

If you need to store the value in a field that is not in the form's
recordsource, you can execute an inline Update or Append query to do it.
If it's an Update query, you need to be able to provide the query with
the key of the record you want to update. If it's an Append query, you
may or may not have to provide other field values for the record you
want to insert in the table. I can't be more specific with the
information you've provided so far.
 
Top