This is how I would do it:
Paste the following code into a new module:
Function QandX(QryN As String, QryN2 as string fileName As String)
On Error GoTo erh
DoCmd.SetWarnings False
DoCmd.OpenQuery QryN
DoCmd.SetWarnings True
DoCmd.OutputTo acOutputQuery, QryN2, "Text Files (*.txt)", fileName,
False
xit:
DoCmd.SetWarnings True
Exit Function
erh:
MsgBox Error$
Resume xit
End Function
Then make a macro where you choose the following command:
runcode
then in the little entry box you write
QandX(x,y, y)
where x is the name of the query you are running, and
y the name ofthe query that you are outputting, and
z the filename that you want it to be.
Lastly, you include the macro in your switchboard.
Any further questions, please ask
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 31/05/2004
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.693 / Virus Database: 454 - Release Date: 31/05/2004