Export Text Wizard: Too Few Parameters Expected 3 (1 Viewer)

AngelSpeaks

Member
Local time
Today, 02:18
Joined
Oct 21, 2021
Messages
84
Hi All,

I'm running a query and trying to use the External Data Export to Text File Wizard to export the query results. I've searched the Internet, and the only time I see this is when a query is referencing a Form. I've changed that to use TempVars.

Here is my SQL behind the query:

PARAMETERS [TempVars]![NoWork] Bit, [TempVars]![StartDate] DateTime, [TempVars]![EndDate] DateTime;
SELECT [TempVars]![StartDate] AS PayrollStart, [TempVars]![EndDate] AS PayrollEnd, tblEmployers.ContractorNo AS ContractNumber, tblPWBenefits.Job AS ProjectNumber, qryJobsPublic.Address AS ProjectAddress, qryJobsPublic.County AS ProjectCounty, qryJobsPublic.CountyFIPS AS ProjectCountyFIPSCode, qryJobsPublic.City AS ProjectCity, qryJobsPublic.State AS ProjectState, qryJobsPublic.ZipCode AS ProjectZip5, qryJobsPublic.Zip4 AS [Zip-4], IIf([qryJobsPublic].[CapitalFund],"1","0") AS StateCapitalFunds, tblEmployers.Employer_Name AS CompanyName, tblEmployers.Contact_First AS ContactFirstName, tblEmployers.Contact_Middle AS ContactMiddleName, tblEmployers.Contact_Person AS ContactLastName, tblEmployers.Address_Line1 AS PostalAddress, tblEmployers.CountyFIPSCode, tblEmployers.City, tblEmployers.State, tblEmployers.ZipCode AS Zip5, tblEmployers.Zip4 AS [Zip 4], tblEmployers.Telephone AS PrimaryPhone, tblEmployers.FAX AS SecondaryPhone, tblEmployers.Email AS PrimaryEmail, tblEmployers.Secondary_Email AS SecondaryEmail, qryJobsPublic.PublicBodyName, qryJobsPublic.Contact_Person AS PublicBodyContactFirstName, qryJobsPublic.Contact_Middle AS PublicBodyContactMiddleName, qryJobsPublic.Contact_Person AS PublicBodyContactLastName, qryJobsPublic.PublicBodyAddress, qryJobsPublic.PublicBodyCounty, qryJobsPublic.PBCountyFIPS AS PublicBodyCountyFIPS, qryJobsPublic.PublicBodyCity, qryJobsPublic.PublicBodyState, qryJobsPublic.PublicBodyZip, qryJobsPublic.PublicBodyZip4, qryJobsPublic.PublicBodyTelephone, qryJobsPublic.PublicBodySecondaryTelephone, tblEmployees.First_Name AS FirstName, tblEmployees.Middle_Name AS MiddleName, tblEmployees.Last_Name AS LastName, tblEmployees.SSN4 AS Last4SSN, tblEmployees.Telephone, tblEmployees.SecondaryTelephone, tblEmployees.TradeTitle AS WorkClassification, tblEmployees.Address, tblEmployees.County, " " AS EmployeeCountyFIPS, tblEmployees.City AS [Employee City], tblEmployees.State AS [Employee State], tblEmployees.ZipCode, tblEmployees.Zip4, tblEmployees.Race, IIf([tblEmployees]![Ethnicity],"Y","N") AS Ethnicity, tblEmployees.Gender, IIf([tblEmployees].[Veteran],"1","0") AS IsaVeteran, IIf([tblEmployees].[Journeyman],"1","0") AS Journeyman, IIf([tblEmployees].[Apprentice],"1","0") AS Apprentice, IIf([tblEmployees].[Foreman],"1","0") AS Foreman, tblPWBenefits.PWSunday AS SundayPrevailingHoursWorked, tblPWBenefits.PWSunday AS SundayNonPrevailingHoursWorked, tblPWBenefits.PWMonday AS MondayPrevailingHoursWorked, tblPWBenefits.NPWMonday AS MondayNonPrevailingHoursWorked, tblPWBenefits.PWTuesday AS TuesdayPrevailingHoursWorked, tblPWBenefits.NPWTuesday AS TuesdayNonPrevailingHoursWorked, tblPWBenefits.PWWednesday AS WednsdayPrevailingHoursWorked, tblPWBenefits.NPWWednesday AS WednsdayNonPrevailingHoursWorked, tblPWBenefits.PWThursday AS ThursdayPrevailingHoursWorked, tblPWBenefits.NPWThursday AS ThursdayNonPrevailingHoursWorked, tblPWBenefits.PWFriday AS FridayPrevailingHoursWorked, tblPWBenefits.NPWFriday AS FridayNonPrevailingHoursWorked, tblPWBenefits.PWSaturday AS SatdayPrevailingHoursWorked, tblPWBenefits.NPWSaturday AS SatdayNonPrevailingHoursWorked, tblPWBenefits.[Total Hrs] AS TotalPrevailingStraightHoursWorked, tblPWBenefits.[NPW Regular] AS TotalNonPrevailingStraightHoursWorked, tblPWBenefits.OTHrs AS TotalPrevailingOTHoursWorked, tblPWBenefits.[NPW OTHrs], tblPWBenefits.[Base Wage] AS PrevailingHourlyWage, tblPWBenefits.[OT Wage] AS PrevailingOTWage, tblPWBenefits.[NPW OT Wage] AS NonPrevailingOTWage, tblPWBenefits.[Gross Earned] AS PrevailingGrossIncome, 0 AS PrevailingNetIncome, tblPWBenefits.[NPW Gross Earned] AS NonPrevailingGrossIncome, 0 AS NonPrevailingNetIncome, tblPWBenefits.[Pension Earned] AS HourlyPensionRetirement, tblPWBenefits.[HW Rate] AS HourlyHealthInsuranceWelfare, tblPWBenefits.[Vacation Earned] AS HourlyVacationAccrued, tblPWBenefits.[Training Earned] AS HourlyTrainingAccrued, 0 AS IsFundJointlyManaged, tblPWBenefits.DTHrs AS PrevailingDoubleTimeHours, tblPWBenefits.[NPW DTHrs] AS NonPrevailingDoubleTimeHours, tblPWBenefits.[DT Wage] AS PrevailingDoubleTimeWageRate, tblPWBenefits.[NPW DT Wage] AS NonPrevailingDoubleTimeWageRate, [TempVars]![NoWork] AS NoWorktoReport
FROM tblEmployers, (tblCounty INNER JOIN (tblPWBenefits INNER JOIN tblEmployees ON tblPWBenefits.Employee = tblEmployees.Employee) ON tblCounty.County = tblPWBenefits.County) INNER JOIN qryJobsPublic ON (tblPWBenefits.Job = qryJobsPublic.[Job]) AND (tblCounty.County = qryJobsPublic.[County])
WHERE (((tblPWBenefits.Date) Between [TempVars]![StartDate] And [TempVars]![EndDate]))
ORDER BY tblPWBenefits.Job;



Thanks so much!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:18
Joined
Oct 29, 2018
Messages
17,628
Did you make sure the TempVars were not empty before trying to export the data? Just curious...
 

isladogs

CID VIP
Local time
Today, 08:18
Joined
Jan 14, 2017
Messages
15,675
Do you actually need the PARAMETERS clause? Try removing it
 

isladogs

CID VIP
Local time
Today, 08:18
Joined
Jan 14, 2017
Messages
15,675
The Parameters clause was needed to get the TempVars to work.
Really? I've not found that to be the case.
What if you instead use CBool & CDate to wrap those fields in your query SQL?
 

Users who are viewing this thread

Top Bottom