I am trying to get the average, minimum, and maximum from a table and display the asnwers in text boxes on my report.
Here is my code:
gstrSQL = "SELECT Avg(SData.Test1) AS AvgScore, Min
(SData.Test1) AS MinScore, Max(SData.Test1) AS MaxScore"
gstrSQL = gstrSQL & "FROM SData;"
Set rsTotalStudents = gdbAll.OpenRecordset(gstrSQL,
dbOpenSnapshot)
txtHighGrade = rsTotalStudents![MaxScore]
txtLowGrade = rsTotalStudents![MinScore]
txtAverageGrade = rsTotalStudents![AvgScore]
rsTotalStudents.Close
Here is the error I am getting:
The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
It highlights the Set rsTotalStudents Line after giving me this error. I have went through and checked to see what is working and the SQL statement is o-kay. I have starred at this code way too long, I can not see the problem. Any comments/suggestions are greatly appreciated.
Thank You,
nicmar
Here is my code:
gstrSQL = "SELECT Avg(SData.Test1) AS AvgScore, Min
(SData.Test1) AS MinScore, Max(SData.Test1) AS MaxScore"
gstrSQL = gstrSQL & "FROM SData;"
Set rsTotalStudents = gdbAll.OpenRecordset(gstrSQL,
dbOpenSnapshot)
txtHighGrade = rsTotalStudents![MaxScore]
txtLowGrade = rsTotalStudents![MinScore]
txtAverageGrade = rsTotalStudents![AvgScore]
rsTotalStudents.Close
Here is the error I am getting:
The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
It highlights the Set rsTotalStudents Line after giving me this error. I have went through and checked to see what is working and the SQL statement is o-kay. I have starred at this code way too long, I can not see the problem. Any comments/suggestions are greatly appreciated.
Thank You,
nicmar