-----Original Message-----
This is the culprit. Hope you can see the problem.
Set db = CurrentDb
Set rstBullet = db.OpenRecordset("SELECT * FROM
tblReportsBullet WHERE GradeType='" & strType & "'")
Select Case strType
Case "outcome"
With rstBullet
Do Until .EOF
Select Case !gradevalue
Case "0"
Case "1"
.Edit
rstBullet!Grade1 = "l"
.Update
Case "2"
.Edit
rstBullet!Grade5 = "l"
.Update
Case "3"
.Edit
rstBullet!Grade4 = "l"
.Update
Case "4"
.Edit
rstBullet!Grade3 = "l"
.Update
Case "5"
.Edit
rstBullet!Grade2 = "l"
.Update
End Select
.MoveNext
Loop
End With
Case "VET"
With rstBullet
Do Until .EOF
.Edit
Select Case !gradevalue
Case "0"
Case "1"
rstBullet!Grade1 = "l"
Case "2"
rstBullet!Grade2 = "l"
Case "3"
rstBullet!Grade3 = "l"
Case "4"
rstBullet!Grade4 = "l"
Case "5"
rstBullet!Grade5 = "l"
End Select
.Update
.MoveNext
Loop
End With
End Select
rstBullet.Close
Set rstBullet = db.OpenRecordset("SELECT * FROM
tblReportsBullet WHERE GradeType='Profile'")
'Set rstBullet = db.OpenRecordset ("tblReportsBullet")
With rstBullet
Do Until .EOF
.Edit
Select Case !gradevalue
Case "0"
Case "1"
rstBullet!Grade1 = "l"
Case "2"
rstBullet!Grade2 = "l"
Case "3"
rstBullet!Grade3 = "l"
Case "4"
rstBullet!Grade4 = "l"
Case "5"
rstBullet!Grade5 = "l"
End Select
.Update
.MoveNext
Loop
End With
rstBullet.Close
Set db = Nothing
You might try something like this (be warned -- this will be "air SQL",
so I don't guarantee its correctness):
'----- start of revised code -----
Set db = CurrentDb
Select Case strType
Case "outcome"
db.Execute _
"UPDATE tblReportsBullet SET Grade1 = 'l' " & _
"WHERE GradeType='outcome' AND gradevalue = '1'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade5 = 'l' " & _
"WHERE GradeType='outcome' AND gradevalue = '2'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade4 = 'l' " & _
"WHERE GradeType='outcome' AND gradevalue = '3'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade3 = 'l' " & _
"WHERE GradeType='outcome' AND gradevalue = '4'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade2 = 'l' " & _
"WHERE GradeType='outcome' AND gradevalue = '5'", _
dbFailOnError
Case "VET"
db.Execute _
"UPDATE tblReportsBullet SET Grade1 = 'l' " & _
"WHERE GradeType='VET' AND gradevalue = '1'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade2 = 'l' " & _
"WHERE GradeType='VET' AND gradevalue = '2'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade3 = 'l' " & _
"WHERE GradeType='VET' AND gradevalue = '3'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade4 = 'l' " & _
"WHERE GradeType='VET' AND gradevalue = '4'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade5 = 'l' " & _
"WHERE GradeType='VET' AND gradevalue = '5'", _
dbFailOnError
End Select
db.Execute _
"UPDATE tblReportsBullet SET Grade1 = 'l' " & _
"WHERE GradeType='Profile' AND gradevalue = '1'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade2 = 'l' " & _
"WHERE GradeType='Profile' AND gradevalue = '2'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade3 = 'l' " & _
"WHERE GradeType='Profile' AND gradevalue = '3'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade4 = 'l' " & _
"WHERE GradeType='Profile' AND gradevalue = '4'", _
dbFailOnError
db.Execute _
"UPDATE tblReportsBullet SET Grade5 = 'l' " & _
"WHERE GradeType='Profile' AND gradevalue = '5'", _
dbFailOnError
'----- end of revised code -----
That's 10 update queries that could potentially be executed to perform
your process, if I've correctly identified the updates you need, but
each one should update all the qualifying records in one go. The
queries will be *much* more efficient if the fields [GradeType] and
[gradevalue] are indexed. I don't know for sure if this will have an
effect on your bloating, but it's worth a try.
I'd like to verify, by the way that the fields [Grade1] through
[Grade5], and [gradevalue], are all text fields. You're enclosing their
values in quotes, so I assume so, but if they aren't actually text
fields the quotes around the values will force, at best, unnecessary
conversions.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.