GetFileName Property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm trying to figure out a way on bringing a file look a dialogue box to
insert a picture into my database. Can you please give me the simplest method
that would allow me to accomplish this since I'm not very familiar with the
VB Codes.

Thanks,
Your help is appreciated in advance
 
Realistically, while there might be slightly simpler approaches than what's
shown in http://www.mvps.org/access/api/api0001.htm at "The Access Web",
none are as good.

It really doesn't matter how familiar you are with VB. Copy everything in
the shaded section (between Code Start and Code End) and paste it into a new
module (not a class module nor a module associated with a form or report).
Make sure you do not name the module the same as any of the routines within
it. (I usually prefix all my modules with mdl or bas to avoid this problem).

Then, whenever you want to call the dialog, you use the code at the top of
the page. To allow the user to select a GIF, JPEG or PNG file, you'd use
something like:

Dim strFilter As String
Dim strInputFileName as string

strFilter = ahtAddFilterItem(strFilter, "Graphic Files (*.gif, *.jpg,
*.png)", _
"*.gif;*.jpg;*.jpeg;*.png")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

The variable strInputFileName would hold the name of the selected file (or a
zero-length string) once the user closes the dialog.
 
Back
Top