473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

placing file selected in opendialog box into text box

374 256MB
Hi all,

I am using some cutdown code which I have changed around to allow me to select a file to be attached to an email within my database. The code is as follows:

Expand|Select|Wrap|Line Numbers
  1. Function EmailAttach()
  2.     Dim strFilter As String
  3.     Dim lngFlags As Long
  4.     Dim strInputFileName As String
  5.  
  6.     strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
  7.                     "*.MDA;*.MDB")
  8.     strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
  9.     strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
  10.     strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.pdf)", "*.PDF")
  11.     strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
  12.     strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _
  13.         Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
  14.         DialogTitle:="Select attachment!
  15.  
  16. End Function
However, I am utterly useless at working with functions. How do I get the filename/path selected to be input into a textbox that I specify.

I have tried changing strInputFileName = to me.mail_attachement_path.value with no luck.

I am calling the function from a button where I have also tried:

Me.mail_attachement_path.value = EmailAttach with no luck.
Oct 11 '10 #1

✓ answered by munkee

Solved it!

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command34_Click()
  2. Me.Mail_Attachment_Path = EmailAttach()
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Function EmailAttach() As String
  2.     Dim strFilter As String
  3.     Dim lngFlags As Long
  4.     Dim strInputFileName As String
  5.  
  6.     strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
  7.                     "*.MDA;*.MDB")
  8.     strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
  9.     strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
  10.     strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.pdf)", "*.PDF")
  11.     strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
  12.     EmailAttach = ahtCommonFileOpenSave(InitialDir:="C:\", _
  13.         Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
  14.         DialogTitle:="Email attachment
  15.  
  16.  
  17. End Function
  18.  

1 1778
munkee
374 256MB
Solved it!

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command34_Click()
  2. Me.Mail_Attachment_Path = EmailAttach()
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Function EmailAttach() As String
  2.     Dim strFilter As String
  3.     Dim lngFlags As Long
  4.     Dim strInputFileName As String
  5.  
  6.     strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
  7.                     "*.MDA;*.MDB")
  8.     strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
  9.     strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
  10.     strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.pdf)", "*.PDF")
  11.     strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
  12.     EmailAttach = ahtCommonFileOpenSave(InitialDir:="C:\", _
  13.         Filter:=strFilter, FilterIndex:=3, flags:=lngFlags, _
  14.         DialogTitle:="Email attachment
  15.  
  16.  
  17. End Function
  18.  
Oct 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Richard | last post by:
In an attempt to try out some things with php, I have run into a new snag. The output file is pure text. Basically it's a simple photo gallery using <ul> links to show various thumbnails. In...
0
by: Frank Xia | last post by:
How to highlight selected tab text? I only want the tab page text to be highlighted not the whole content on the page. I can't find a related property to be set. Need help here. Thanks a lot!
2
by: Roy Gourgi | last post by:
Hi, How could I append a text file to another text file. Let's say that I have a File1 and I want to append File2 at the end of File1, how would I do that? TIA Roy
9
by: Tristán White | last post by:
Hi I am very new to PHP - actually, this is my second day at it, as I've only recently started a new job last week. We're a charity. I have a "No input file selected" problem. A Google search...
4
by: LouArnold | last post by:
I have a need to replace text in a file with new text. The files may or may not be text files in the sense that there may not be "lines" and they may not contain printable characters. I tried...
3
by: gujarsachin2001 | last post by:
Hi friends, I m just stuck with extracting excel file data into text file. So can any body please help me out. thx, Sachin.
2
kamill
by: kamill | last post by:
i need to write content of one text file into another text file. My code is working ,if i choose both files from same directory where my program reside..BUT,its not working if i select files from...
1
by: gravikiranreddy | last post by:
In pdf file select particular text and when i click on the button in another page textbox-the text should be Pdf selected text using javascript function in VB.net
1
by: Dinu | last post by:
hi i am having a gridview in aspx page and a usercontrol in master page of that page now what i want is selected row text to be displayed in usercontrol i wrote code as follows: ...
10
by: electric_r | last post by:
Hallo, I have 2 questions: with php and mysql : 1) How can I insert a text file into a TEXT field of a table ? 2) How can I insert a microsoft word file into a BLOB field of a table ?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.