TransferText Action

T

thetomster

Hi again :)

Is it possible to create a macro that imports a file without VBA? What
I specifically want it to do is to let a user specify what file he/she
wants to import. From what I have noticed the macro "generator" forces
you to have the path and file name predefined, is there anyway to
bypass this and just let the user browse through and search for the
file he/she wants to import instead?

On a side note, the OutputTo action allows the user to specify the name
and directory to which the file will be saved. Is this an inconsistancy
or did I miss something?

Thanks in advance,
Tom
 
S

Steve Schapel

Tom,

I suppose you would probably be using the TransferText action. You can
put an unbound textbox on a form, and let the user enter the file to
import in there, and then have the macro reference the value of this
textbox. As far as I know, that is as close as you will get in a macro
to the functionality you seek. If you want the user to be able to
browse using the Windows Find File dialog, I think you will have to use
VBA procedure, an example of which can be found here...
http://www.mvps.org/access/api/api0001.htm
 
T

thetomster

Hi Steve,

The thing is that the macro with the TransferTest action won't save, if
there is no path and file name specified, so the TT action in this case
is useless. How do I link the unbound text box with an import action?
I'm starting to think that without being knowledgable in VBA it will be
quite difficult, if not impossible, to create a macro that will allow a
user to choose a file and have it imported to Access.

Tom
 
S

Steve Schapel

Tom,

If the user can enter the file path/name in an unbound textbox on a
form, then in the File Name argument of the TransferText in your macro,
you enter like this...
=[Forms]![NameOfFrom]![NameOfTextbox]

Another possible approach would be to put like this in the File Name
argument in the macro...
=InputBox("Enter full path and file name of required file")

I guess it depends on whether the user is aware of the file they need,
and whether they are able to type it accurately. As I mentioned before,
your comment about VBA is correct, if you require browsing functionality.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top