Forum Discussion
MS ACCESS wont read Form Variables as query parameters
I use form variables as parameters in my queries. I have been doing this for 25 years in Access. Recently I have noticed that some of my queries are showing null values for form variables that are present on the form and I can see there is content in them. I can even see data in the immediate window when I reference the form fields in question, but doesn't work anymore in the query.
What would be the reason that referencing a form variables in a query would not work (would not retain the data in the parameter that references a form variable)?
EX:
SELECT tblLoanTypes.LoanTypeCode, tblSDSTeam.ScheduledAttendancePerWeek, tblSDSTeam.StartDateThisAcademicYear, tblSDSTeam.EndDateThisAcademicYear, tblSDSTeam.AwardPeriodBeginDate, tblSDSTeam.AwardPeriodEndDate, tblSDSTeam.NumPaymentPeriodsInThisAward, tblSDSTeam.StudentProgramEnrollmentId, tblSDSTeam.StudentAcademicYearId, tblSDSTeam.StudentAwardId, tblSDSTeam.ExportDate, [Forms]![frmMain]![cRecId] AS Expr1, tblSDSTeam.ScheduledAwardAmount, tblSDSTeam.ScheduledAwardAmount, "R" AS Expr2, [Forms]![frmMain]![cSeq] AS Expr3, Left(Trim([StudentId]),9) AS Expr4, tblSDSTeam.AwardYear
FROM tblSDSTeam INNER JOIN tblLoanTypes ON tblSDSTeam.AwardType = tblLoanTypes.LoanType
WHERE (((tblSDSTeam.StudentProgramEnrollmentId)=[Forms]![frmMain]![nStudentProgramEnrollmentId]) AND ((tblSDSTeam.StudentAcademicYearId)=[Forms]![frmMain]![nStudentAcademicYearId]) AND ((tblSDSTeam.StudentAwardId)=[Forms]![frmMain]![nStudentAwardId]));
The query above worked fin until a month ago. But now all of the form variables are not making it to the query with data in them.
I compacted and repaired, re-created the tables and queries from scratch - with no luck. Any help is appreciated.
Microsoft® Access® for Microsoft 365 MSO (Version 2408 Build 16.0.17928.20066) 64-bit
Windows 11 pro with 32 GIG Ram
Hi,
If absolutely none (?) of the form parameters arrives in the queries any more, then I would try to repair the Access installation.
Servus
Karl
****************
Access News, Forever, DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg