Exporting txt with "too few parameter" error

N

nesster13

Hi,
I am trying to create a query with user input. One field I have in the
query is Type: Left([Please enter type],6). When I run this select
query the output was fine. However, when I tried to export this into a
txt file the "too few parameter: expected 1" error came up. Does
anybody know how I can fix this? Any help is appreciate. Thanks
 
N

nesster13

Well what I did was I ran the query with the field above and it work
fine. But when I go to File and export, then select Text File, it gave
me the too few parameter error. I tried to hard code it and it work
fine. I think that there might be another format to ask for user input.
The problem is with Left([Please enter type],6).
 
G

Guest

Try using the TranferText method of the DoCmd object. Put a button on a form,
in the button click event, type

DoCmd.TransferText acExportDelim, , "qryTooFew", "C:/temp/TooFew.txt"

replace qryTooFew with the name of your query.

Delordson Kallon
http://www.instantsoftwaretraining.com
 
N

nesster13

Thank you very much but I am not very familier with access and cannot
understand what you meant by the statement above.
 
V

Van T. Dinh

You cannot use a Parametrised Query for export. Basically, you need to
resolve the Parameter

[Please enter type]

before you can use File / Export ...
 
G

Guest

As pointed out by Van T. Dinh, Access 2003 doesn't allow you to export a
parameter query to text without first resolving the parameter. Several
solutions are open to you. Three possibilities spring to mind...

1 Export to Excel. This should work without any problems.
2 Covert your query to a "Make-Table" query (on the menu, click Query, then
Make-Table Query and give the new table a name). This will allow you to
export to text in two stages, first run your query to populate the new table,
then export the new table.
3 Use the TransferText method of the DoCmd oject in VBA.

If you are unfamiliar with Access it will probably be easiest to stick to 1
or maybe 2 above.

Delordson Kallon
http://www.instantsoftwaretraining.com/default.aspx
 
N

nesster13

Thank you Delordson. I tried out the first two solutions above and it
worked. However, when i export it as an Excel and then convert it into
a txt file all the spaces messed up. I think I will go with solution
#2. Thanks
 

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