How to create a button that will allow users to attach text files

F

fifi

Hello,
I am trying to create an attach button that will allow users to attach a
text files. Can somebody please tell me how to do that?
Thank you so much for your help
 
R

Rick Brandt

fifi said:
Hello,
I am trying to create an attach button that will allow users to
attach a text files. Can somebody please tell me how to do that?
Thank you so much for your help

Please define what you mean by "attach" and what you want to attach the file to.
 
F

fifi

Hi Rick
I mean a button that when cliqued, will open browser that will allow user
to choose a file they want to attach to the form. Just like when you
emailing a picture, or a word doc.
I hope that my explanation helped.
 
F

fifi

Thank you for your help Mr Steele
but could you please tell me where to put the code because I am a new user
 
D

Douglas J. Steele

Copy the code that's between '***************** Code Start **************
and '***************** Code Stop ************** to a new module, and save it
with a name that's different than any of the routines within. (I tend to
call it something like mdlFileDialog)

There's an example of how to call it at the top of the page:

Dim strFilter As String
Dim strInputFileName as string

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)


In that example, you'll be prompted to look for Excel files (because of what
strFilter was set to in the call to ahtAddFilterItem, and the selected file
will be returned as strInputFileName.
 
F

fifi

Hello again
I did copy the code and named the module.
Now, my question is where do I put the 'call function'? Do I put it in the
same module?
Also, when everything works, will the user have to click to a button to
attach a file?
I am so sorry for asking lot of questions. Please understand, I am a new user

I appreciate your help a lot
 
D

Douglas J Steele

Your original request stated that you wanted to have a button that the user
would click to invoke the browser. You put the code to call the routine in
the Click event for that button.

Remember, too, that all that code does is return a file name. You still have
to add the code to do something with that file.
 
F

fifi

thank you so much Mr. Steele for your help. I just can't thank you enough.
Now the browser is invoked when I clicked the button. Now I would like to
attach the doc to the email that I am sending when a user click the submit
button
You are a life saver
 
R

Roger

Hi Doug,

I have been looking at your thread with fifi and have run the code you
stated in your replies which has worked. However in your final post you
mention running some code to do something with the file. I'd like to return
the path name of the file to a field in my database. I was wondering if you
had some code that would allow me to do that?

Regards
Roger
 
Top