How to call an open dialog box in MS Access?

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

Hello everyone!

I wanted to have an open dialog box popping up once I'm clicking an
OLE object field in a Microsoft Access form, so that one can browse
for the file that shall be included.
At http://www.mvps.org/access/api/api0001.htm I've already found some
kind of solution. But unfortunately, the selected file won't be stored
in my Access document after clicking the open button. Just nothing
seems to happen.
I'm just a biologist and don't understand a lot of VBA, yet. That's
why I would be very grateful if someone could give me some simple
advice, how to modify the code in order to include the selected file
after pressing the open button of the dialog box.

Thanks a lot,
Patrick.
 
All that API does is return a file name (and path, of course). You have to
assign it somewhere yourself. On my website (www.rogersaccesslibrary.com)
is a small sample database called: "SaveFileToSpecificDirectory.mdb", which
illustrates how to use this API in a Save operation. Unfortunately, I don't
have one for Open, but perhaps you can generalize from this.

Secondly, if you are storing pictures in your OLE object, I would advise
against it. It will bloat your database very quickly. The more common
solution is to leave the pictures on the file system and simply store the
full path to the picture in a text field. Then you can programmatically
load the picture into an unbound OLE control at run-time. I also have a
sample called "Pictures.mdb" on my website which shows this.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top