How do I prompt for a parameter when I want to import using a macr

G

ginger

I am using the transferdatabase action in a macro. I will be importing
several dozen files that only vary by a single name. How can I use a variable
in the database name argument that prompts the user for a parameter?
 
S

Steve Schapel

Ginger,

I don't think I have ever tried this, so I'm not sure if this will work,
but you could try it the equivalent of this, in the Database Name
argument of the TransferDatabase action in your macro...
="C:\YourFolder\" & InputBox("Enter file name") & ".mdb"
 
K

Ken Snell [MVP]

It'll work < g >

--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Ginger,

I don't think I have ever tried this, so I'm not sure if this will work,
but you could try it the equivalent of this, in the Database Name argument
of the TransferDatabase action in your macro...
="C:\YourFolder\" & InputBox("Enter file name") & ".mdb"
 
G

ginger

Is there a way I can save this so I can use this again and they do not have
to re-enter it? There will be 4 other files that I will need that parameter
for.
 
G

ginger

Please let me clarify. I am sorry I am not being clear, I am not very
experienced.
I have 43 field offices with 6 databases. Inside each database is 1 table I
want imported. So I want to repeat the field office name 5 times after it is
entered once.

Ken Snell said:
It'll work < g >
 
S

Steve Schapel

Ginger,

You could have an unbound textbox on a form where the macro is triggered
from, and the user can enter the name of the file name in there, and
then your Database Name argument can be the equivalent of...
="C:\YourFolder\" & [NameOfTheTextbox] & ".mdb"

On another topic... Do you mean there are 6 databases in each of the 43
offices? Can you say what is the difference between the 6 databases?
What you are doing is very unusual, and leads me to suspect that the
whole thing could be simplified.
 
K

Kee

Is it possible to use wild card characters in this function when looking for
a files that vary by a few numbers?

Steve Schapel said:
Ginger,

You could have an unbound textbox on a form where the macro is triggered
from, and the user can enter the name of the file name in there, and
then your Database Name argument can be the equivalent of...
="C:\YourFolder\" & [NameOfTheTextbox] & ".mdb"

On another topic... Do you mean there are 6 databases in each of the 43
offices? Can you say what is the difference between the 6 databases?
What you are doing is very unusual, and leads me to suspect that the
whole thing could be simplified.

--
Steve Schapel, Microsoft Access MVP

Please let me clarify. I am sorry I am not being clear, I am not very
experienced.
I have 43 field offices with 6 databases. Inside each database is 1 table I
want imported. So I want to repeat the field office name 5 times after it is
entered once.
 

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