I have a query 'qry_LOI2' whose SQL is as follows:
(It did have a lot more fields, but I have removed most of them during debugging to try to isolate the problem). It opens successfully by double-clicking it in the the GUI Navigation pane, but when I try to open it as a recordset in VBA it fails with Error 3061 ("Too few parameters"). The VBA line is
What could cause this?
(The query that it uses, 'qry_LOI', is as follows:
(The stray whitespaces scattered through the above code are not there in the original).
As well as removing most of the fields from qry_LOI2, I have also tried rebuilding it frrom scratch, but that didn't help.
Code:
SELECT qry_LOI.*, "Para 5" AS Para5 FROM qry_LOI INNER JOIN LOIPayerText ON qry_LOI.WhoPays = LOIPayerText.Wh oPays;
Code:
Set rsLOI2 = CurrentDb.OpenRecordset("qry_LOI2", dbOpenDynaset)
(The query that it uses, 'qry_LOI', is as follows:
Code:
SELECT
qry_Applicant.P ersonID,
qry_Applicant.[Name_FN-SN],
qry_Applicant.T itle,
qry_Applicant.F irst_name,
qry_Applicant.S urname,
qry_Applicant.D ate_last_invite d,
DateDiff("d", [Date_last_invit ed], Date()) AS Days_since_last _invited,
qry_Applicant.R esponse,
qry_Applicant.G ender,
qry_Applicant.E ventCode,
qry_NextWalks.E ventType,
qry_Applicant.D ate_of_Birth,
qry_Applicant.S treet,
qry_Applicant.S uburb_text,
qry_Applicant.H ome_phone,
qry_Applicant.S ilent,
qry_Applicant.M obile,
qry_Applicant.E mail,
qry_Applicant.S uppress_contact _info,
qry_Applicant.C hurch_NDS,
qry_NextWalks.N ext_Walk,
Venue ([qry_NextWalks].[Next_Walk]) AS Venue_name,
qry_NextWalks.V enueAddress,
qry_NextWalks.C lightVenue,
qry_NextWalks.C lightAddress,
qry_NextWalks.S tartDate,
qry_NextWalks.S TC,
qry_NextWalks.C omments,
qry_Applicant.W ho_pays,
Switch (
[Who_pays] = "P",
"Pilgrim",
[Who_Pays] = "S",
"Sponsor",
[Who_pays] = "B",
"Both",
[Who_pays] = "C",
"Community"
) AS WhoPays,
qry_Applicant.F ees_payable,
qry_Applicant.F ees_received,
qry_Applicant.S ponsor,
qry_Applicant.S ponsorEmail,
[qry_NextWalks].[Next_Walk] & "/P" & [PersonID] & "-" & [Surname] AS RefNo,
qry_OfficeBeare r.Name_FnSn AS OfficeBearer,
qry_OfficeBeare r.OfficeBearers Title,
qry_OfficeBeare r.OfficeBearers Street,
qry_OfficeBeare r.OfficeBearers Suburb,
qry_OfficeBeare r.OfficeBearers Email,
EventOffset ([qry_Applicant].[EventCode]) AS
OFFSET
,
qry_NextWalks.R egistrar
FROM
qry_Applicant
INNER JOIN (
qry_NextWalks
INNER JOIN qry_OfficeBeare r ON qry_NextWalks.R egistrar = qry_OfficeBeare r.Position_Titl e
) ON qry_Applicant.E ventCode = qry_NextWalks.E ventCode
WHERE
(
((qry_Applicant .PersonID) > 1)
AND (
(DateDiff("d", [Date_last_invit ed], Date())) > 60
OR (DateDiff("d", [Date_last_invit ed], Date())) IS NULL
)
AND (
(qry_Applicant. Response) IN ("D", "E", "F", "W")
OR (qry_Applicant. Response) IS NULL
)
AND ((qry_Applicant .Gender) IS NOT NULL)
AND ((qry_NextWalks .Next_Walk) IS NOT NULL)
AND ((qry_Applicant .Who_pays) IS NOT NULL)
)
ORDER BY
qry_Applicant.G ender DESC;
As well as removing most of the fields from qry_LOI2, I have also tried rebuilding it frrom scratch, but that didn't help.
Comment