A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Importing files from code



 
 
Thread Tools Display Modes
  #1  
Old June 7th, 2004, 09:10 PM
Justin Busch
external usenet poster
 
Posts: n/a
Default Importing files from code

I am currently working on a simple stepping stone to store student records.
What I would like to do is setup a form that when a Command Button is
pressed, an Open File Dialog box is created. The user can then select the
appropriate file and that filename and path is set to a string variable such
that I can use the doCmd.TransferText( acImportDelim, .....)

Is this possible and if so what is the best method of doing so?

Thank you


  #2  
Old June 7th, 2004, 10:00 PM
Larry Linson
external usenet poster
 
Posts: n/a
Default Importing files from code

"Justin Busch" wrote

What I would like to do is setup a
form that when a Command Button is
pressed, an Open File Dialog box is
created. The user can then select the
appropriate file and that filename and
path is set to a string variable


http://www.mvps.org/access/api/api0001.htm describes how to directly use the
Windows Common Dialog via its API, and does exactly what you describe. It
even has sample code for how to use it.

Larry Linson
Microsoft Access MVP


  #3  
Old June 8th, 2004, 06:39 PM
Justin Busch
external usenet poster
 
Posts: n/a
Default Importing files from code


"Larry Linson" wrote in message
...
"Justin Busch" wrote

What I would like to do is setup a
form that when a Command Button is
pressed, an Open File Dialog box is
created. The user can then select the
appropriate file and that filename and
path is set to a string variable


http://www.mvps.org/access/api/api0001.htm describes how to directly use

the
Windows Common Dialog via its API, and does exactly what you describe. It
even has sample code for how to use it.

Larry Linson
Microsoft Access MVP



Thank you for the assist Larry. Just one more quick question, that I hope
you or others can answer.

How can I set the Dialog Box Title to a specific string of text.


  #4  
Old June 8th, 2004, 06:44 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Importing files from code

"Justin Busch" wrote in message
...

"Larry Linson" wrote in message
...
"Justin Busch" wrote

What I would like to do is setup a
form that when a Command Button is
pressed, an Open File Dialog box is
created. The user can then select the
appropriate file and that filename and
path is set to a string variable


http://www.mvps.org/access/api/api0001.htm describes how to directly use

the
Windows Common Dialog via its API, and does exactly what you describe.

It
even has sample code for how to use it.

Larry Linson
Microsoft Access MVP



Thank you for the assist Larry. Just one more quick question, that I hope
you or others can answer.

How can I set the Dialog Box Title to a specific string of text.




  #5  
Old June 8th, 2004, 06:45 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Importing files from code

"Justin Busch" wrote in message
...

Thank you for the assist Larry. Just one more quick question, that I hope
you or others can answer.

How can I set the Dialog Box Title to a specific string of text.


The example at http://www.mvps.org/access/api/api0001.htm shows you how:

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)

sets the title to "Please select an input file..."

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)








  #6  
Old June 8th, 2004, 06:52 PM
Justin Busch
external usenet poster
 
Posts: n/a
Default Importing files from code


"Douglas J. Steele" wrote in message
...
"Justin Busch" wrote in message
...

Thank you for the assist Larry. Just one more quick question, that I

hope
you or others can answer.

How can I set the Dialog Box Title to a specific string of text.


The example at http://www.mvps.org/access/api/api0001.htm shows you how:

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)

sets the title to "Please select an input file..."

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)


Thank you Doug,

That worked out perfectly.

I was originally trying based on the pop-up fields and resulted with this:
strOutputFileNameEnroll = ahtCommonFileOpenSave([OpenFile:=False,
Filter:=strFilter, Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY], , , ,
, , title)

Thank you all again!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.