By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

Using Variable in DoCmd Export Statement

P: n/a
I'm sure this has been answered, and I've looked but can't quite find
what I'm looking for.

I have

Path = "I:/voucher.txt"
DoCmd.TransferText acExportFixed, "voucher_fixed", "voucher_creation",
Path, No

This runs the query voucher_creation. During that query the user is
asked to input a string "1234". I want to insert the string into the
file name when it's output. So file would be "1234voucher.txt". I'm
not clear how I tell it to add something to the output. (I'm not well
versed in how to pass variables between the query and my procedure if
that's what's needed.

Jan 5 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Here's how I would do this:

Create a form (frmOutput), with a text box (named txtVoucher), and a
button to kick off the export. In the query, replace [InputString]
part with Forms!frmOutput!txtVoucher. On the code of the button, use:

DoCmd.TransferText acExportFixed, "voucher_fixed","voucher_creation",
"I:/" & txtOutput & "Voucher.txt",No

Chris Nebinger

ve***@aol.com wrote:
I'm sure this has been answered, and I've looked but can't quite find
what I'm looking for.

I have

Path = "I:/voucher.txt"
DoCmd.TransferText acExportFixed, "voucher_fixed", "voucher_creation",
Path, No

This runs the query voucher_creation. During that query the user is
asked to input a string "1234". I want to insert the string into the
file name when it's output. So file would be "1234voucher.txt". I'm
not clear how I tell it to add something to the output. (I'm not well
versed in how to pass variables between the query and my procedure if
that's what's needed.
Jan 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.