F
Fred Boer
Dear Ken:
Thank you! That's great advice - and something new I've learned!
--
Fred Boer - Amateur Access Enthusiast
Interests: Library software / Z39.50 / Web Services
Freeware Small Library Application available here:
http://www3.sympatico.ca/lornarourke/
Thank you! That's great advice - and something new I've learned!
--
Fred Boer - Amateur Access Enthusiast
Interests: Library software / Z39.50 / Web Services
Freeware Small Library Application available here:
http://www3.sympatico.ca/lornarourke/
Ken Snell (MVP) said:Fred -
In cases like these, I explicting declare the parameters in the query to
avoid data mismatching that won't give an error but don't produce any
records either (e.g., a date/time value that is interpreted as something
other than a date/time value). Try this for the subform's RecordSource
query (assuming that ClassID is a Long Integer data type):
PARAMETERS [Forms]![frmNewDayBook]![txtLessonDate] DateTime,
[Forms]![frmNewDayBook]![txtClassID] Long;
SELECT tblAttendance.AttendanceID, tblAttendance.StudentClassID,
tblAttendance.AttendanceCode, tblAttendance.ClassDate,
tblStudentClasses.ClassID, tblstudents.StudentLastname & ", " &
tblStudents.StudentFirstName & " " & tblstudents.StudentMidName AS
FullName
FROM (tblStudents RIGHT JOIN tblStudentClasses ON tblStudents.StudentID =
tblStudentClasses.StudentID) LEFT JOIN tblAttendance ON
tblStudentClasses.StudentClassID = tblAttendance.StudentClassID
WHERE (((tblAttendance.ClassDate)=[Forms]![frmNewDayBook]![txtLessonDate])
AND ((tblStudentClasses.ClassID)=[Forms]![frmNewDayBook]![txtClassID]))
ORDER BY tblStudents.StudentLastName, tblStudents.StudentFirstName;
--
Ken Snell
<MS ACCESS MVP>
Fred Boer said:Hi Ken:
Sorry if I wasn't clear! The form is called "frmNewDaybook" is actually
based on a table called "tblLessons", with the fields:
LessonID (Autonumber PK)
ClassID
LessonDate
LessonTopic
LessonNotes
frmNewDaybook is based on a filtered version of the table, based on
choices of class and date made by made in frmSelection, which is the
first form shown, and which actually opens frmNewDaybook.
The attendance subform is based on the following query:
SELECT tblAttendance.AttendanceID, tblAttendance.StudentClassID,
tblAttendance.AttendanceCode, tblAttendance.ClassDate,
tblStudentClasses.ClassID, tblstudents.StudentLastname & ", " &
tblStudents.StudentFirstName & " " & tblstudents.StudentMidName AS
FullName
FROM (tblStudents RIGHT JOIN tblStudentClasses ON tblStudents.StudentID =
tblStudentClasses.StudentID) LEFT JOIN tblAttendance ON
tblStudentClasses.StudentClassID = tblAttendance.StudentClassID
WHERE
(((tblAttendance.ClassDate)=[Forms]![frmNewDayBook]![txtLessonDate]) AND
((tblStudentClasses.ClassID)=[Forms]![frmNewDayBook]![txtClassID]))
ORDER BY tblStudents.StudentLastName, tblStudents.StudentFirstName;
The application has the following tables:
tblAttendance (AttendanceID, StudentClassID, AttendanceCode, ClassDate)
tblClasses (ClassID, ClassName)
tblLessons (LessonID, ClassID, Lesson Date, LessonTopic, LessonNotes)
tblStudentClasses (StudentClassID, StudentID, ClassID)
tblStudents (StudentID, StudentLastname...)
Cheers!
Fred
Ken Snell (MVP) said:Ken, I've been thinking, (although I am not going to think anymore
after this post <g> - at least not tonight). If we assume the the
"error" is that the form is opening without data - then timing isn't an
issue, since it will open blank whether I step through the code or not.
Does that make sense? Error messages do occur if I try to do anything
once the form is open, but it opens without error messages (though the
blankness is itself an "error").
I misunderstood your info then -- I thought I'd read that the problem
didn't occur when you stepped through the code, but did occur when your
code ran on its own.
If the form is opening without records, then likely the query is not
reading the parameter or WHERE filter correctly. Can you post the SQL
statement of the form's Recordsource query?