Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Can't find syntax to reference recordset values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Laurel - 14 Jul 2007 04:27 GMT
I have a select statement in my code that references a query.  My problem is
that I can't find any syntax that will allow me to get at the Student_id and
Att_Date values.  Everything I've tried results in the error   "Item not
found in collection."   If I try various forms in the Immediate window
(print irst_students.tblattendance.student_id", etc., the error is -
"Compile Error - Method or data member not found."
Student_ID must appear in both the ls_sql Select and in
qryGradesForAbsentStudents, because, as you see, I'm testing for null values
in qryGradesForAbsentStudents.

There are two rows in the recordset.

I've tried irst_Students!tblAttendance.Student_id,
irst_Students![tblAttendance].[Student_id],
irst_students![tblattendance.student_id].   HELP!

This is my code for opening the recordset.
Set irst_Students = CurrentDb.OpenRecordset(ls_sql)

This is the value of ls_sql:

SELECT tblAttendance.Student_id, tblAttendance.Att_Date,
qryGradesForAbsentStudents.*, fncAbsent([tblattendance].[student_id]) AS
Expr1  FROM tblAttendance LEFT JOIN qryGradesForAbsentStudents ON
(tblAttendance.Att_Date = qryGradesForAbsentStudents.Assessment_Date) AND
(tblAttendance.Student_ID =
qryGradesForAbsentStudents.tblStudents.Student_id)  WHERE
(((fncAbsent([tblattendance].[student_id]))=True) and
(qryGradesForAbsentStudents.tblAcademics.Student_id is null)) ORDER BY
qryGradesForAbsentStudents.Last_Name, qryGradesForAbsentStudents.First_Name

This is the syntax for qryGradesForAbsentStudents

SELECT tblAcademics.*, [last_name] & ", " & [first_name] AS Expr1,
tblStudents.*
FROM tblAcademics INNER JOIN tblStudents ON tblAcademics.Student_id =
tblStudents.Student_ID
WHERE (((tblAcademics.Subject)='Literacy') AND
((tblStudents.Class_Code)='Test'))
ORDER BY [last_name] & ", " & [first_name];
Ken Snell (MVP) - 14 Jul 2007 16:58 GMT
Try

irst_Students![tblAttendance.Student_id]

or

irst_Students.Fields("tblAttendance.Student_id")

Signature

       Ken Snell
<MS ACCESS MVP>

>I have a select statement in my code that references a query.  My problem
>is that I can't find any syntax that will allow me to get at the Student_id
[quoted text clipped - 37 lines]
> ((tblStudents.Class_Code)='Test'))
> ORDER BY [last_name] & ", " & [first_name];
Marshall Barton - 14 Jul 2007 17:04 GMT
>I have a select statement in my code that references a query.  My problem is
>that I can't find any syntax that will allow me to get at the Student_id and
[quoted text clipped - 36 lines]
>((tblStudents.Class_Code)='Test'))
>ORDER BY [last_name] & ", " & [first_name];

You should list the individal fields in the select caluse
instead of using table.*

This way, you can either eliminate the duplicate field or
alias one of them so a field name is not ambiguous.

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.