473,322 Members | 1,409 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,322 software developers and data experts.

Using Variable in DoCmd Export Statement

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
1 4244
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thierry Schmitt | last post by:
Hello all, I m quite sure that s a common problem and even that the answer to it has been given somewhere, forgive my lack of perspicacity but here is my problem: In the vba code of a button on...
5
by: Mark | last post by:
Hi All, Is there a way to (whilst using the sendobject command) use a query as the source of email addresses. I ask this because the list is constanly changing and I don't want to keep going into...
3
by: bwhite | last post by:
I have a temp table with one row of data that I need to export into Excel. I created the export to create the xls file as follows ... Dim FileName FileName = !! DoCmd.SetWarnings False...
3
by: mukeshsrivastav | last post by:
Dear sir, I want to create a query at runtime and assigning value to them through a sql query.what is the error here. error is shown over variable qdf declaration Dim QDF As QUERYDEF 'On...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
0
by: sschus1 | last post by:
I keep getting a "Missing ; from statement" Also how do you reference the linkage id? I'm completely stuck. What i am trying ot do is write a script that selects a movieclip from the library,...
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
2
by: franc sutherland | last post by:
Hello, I am using Access 2003. Is it possible to use string variables in the INSERT INTO statement? I am using the INSERT INTO statement to add a long list of contacts to a group by looping...
4
MMcCarthy
by: MMcCarthy | last post by:
I recently had occasion to want to export the results of a query from Access to Excel using FileDialog. I found researching it that there was a lot of confusion regarding whether SaveAs could even...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.