Too Few Parameters saving query to text

cthawkinson

New member
Local time
Today, 02:45
Joined
Oct 1, 2010
Messages
2
Greetings!

I'm trying to save the following Query to a fixed width text file in Access 2007:

PARAMETERS [StartDate] DateTime, [EndDate] DateTime, [ReportingPeriod] Char;
SELECT
5500220008 AS UIAccountNumber,
[ReportingPeriod] AS ReportingPeriod,
dbo_tblPrMaster.SocialSecurityNumber,
LEFT(dbo_tblPrMaster.LastName + ' ', 10) AS LastName,
LEFT(dbo_tblPrMaster.FirstName + ' ', 8) AS FirstName,
dbo_tblPrDetailHeader.StateUnemploymentWages,
'01' AS RecordCode,
' ' AS Filler
FROM dbo_tblPrMaster INNER JOIN dbo_tblPrDetailHeader ON dbo_tblPrMaster.EmployeeID = dbo_tblPrDetailHeader.EmployeeID
WHERE (((dbo_tblPrDetailHeader.CheckDate) Between [StartDate] And [EndDate]));

The query gives me the records I need. When I try to save it to a text file (by right-clicking on the query, selecting Export -> Text File, making sure to leave the "with formatting" option unchecked) I get a "Too few parameters. Expected 3" error.

If I check the "with formatting" option checked, I don't get the error, but I get a file that isn't useful.

I suspect since I have three parameters in my query, the error message relates to those parameters. I'm at a loss as to why it works with formatting but doesn't without.

Any thoughts?

Thank you,
Chris
 
Chris,

I have found it best to first append the data from the query to a temp table. Export the temp table to a text file.
 
Thanks for the tip. That worked just fine.

I appreciate the help!
Chris
 

Users who are viewing this thread

Back
Top Bottom