L
Laurel
I'm re-posting this, hopefully more clearly, because I made a mistake in the
original posting, and I know having an answer will slow down more responses,
and I'm desperate to get beyond this before mid-afternoon today. Thanks for
your understanding.
My problem is that in a form with several records showing, when I pass that
form's recordset to a subroutine, the subroutine SOMETIMES (but not
always...so the logic can work) returns the error "No current record" in
its first statement. This is true even though I test both Me.CurrentRecord
and Me.RecordSet.Recordcount before calling it. These values are always
what one would expect. I've been careful to test only with pre-existing
records, to avoid ambiguity with new records being current. I always click
on a row before executing the routine.
I'd be most grateful if someone could help. I worked on this all day
yesterday, and was sure I was about to wrap it up, as the function has been
working nicely until just recently.... Had hoped to show it to the user
today...
sighh...
Note - I'm not yelling with the caps. . I just used them to highlight the
comments inside the script.... Additional explanations/questions.
Dim lrstMe As RecordSet
Set lrstMe = Me.RecordSet
'lrstMe.Update
If (Me.CurrentRecord = 0) Or (lrstMe.RecordCount = 0) Then
THESE VALUES ARE ALWAYS AS EXPECTED
MsgBox ("No current record" & vbCrLf & "Copy will not be done.")
Exit Sub
End If
Select Case optCopyControls
Case 1
Call subCopyScores1(lrstMe, irst_ClassPeriods)
Case 2..... etc
*************
Public Sub subCopyScores1(arst_Scores As RecordSet, arst_periods As
RecordSet)
'Copy the scores from the current row to the rest of the Student's
periods
If (arst_Scores!Period_Code = "B") _ THIS IS WHERE I GET THE
ERROR
Or (arst_Scores!Period_Code = "L") _
Or (arst_Scores!Period_Code = "D") Then
MsgBox ("Periods B, L and D may not be used to generate other
scores.")
Exit Sub
End If
...... etc.
.....
original posting, and I know having an answer will slow down more responses,
and I'm desperate to get beyond this before mid-afternoon today. Thanks for
your understanding.
My problem is that in a form with several records showing, when I pass that
form's recordset to a subroutine, the subroutine SOMETIMES (but not
always...so the logic can work) returns the error "No current record" in
its first statement. This is true even though I test both Me.CurrentRecord
and Me.RecordSet.Recordcount before calling it. These values are always
what one would expect. I've been careful to test only with pre-existing
records, to avoid ambiguity with new records being current. I always click
on a row before executing the routine.
I'd be most grateful if someone could help. I worked on this all day
yesterday, and was sure I was about to wrap it up, as the function has been
working nicely until just recently.... Had hoped to show it to the user
today...
sighh...
Note - I'm not yelling with the caps. . I just used them to highlight the
comments inside the script.... Additional explanations/questions.
Dim lrstMe As RecordSet
Set lrstMe = Me.RecordSet
'lrstMe.Update
If (Me.CurrentRecord = 0) Or (lrstMe.RecordCount = 0) Then
THESE VALUES ARE ALWAYS AS EXPECTED
MsgBox ("No current record" & vbCrLf & "Copy will not be done.")
Exit Sub
End If
Select Case optCopyControls
Case 1
Call subCopyScores1(lrstMe, irst_ClassPeriods)
Case 2..... etc
*************
Public Sub subCopyScores1(arst_Scores As RecordSet, arst_periods As
RecordSet)
'Copy the scores from the current row to the rest of the Student's
periods
If (arst_Scores!Period_Code = "B") _ THIS IS WHERE I GET THE
ERROR
Or (arst_Scores!Period_Code = "L") _
Or (arst_Scores!Period_Code = "D") Then
MsgBox ("Periods B, L and D may not be used to generate other
scores.")
Exit Sub
End If
...... etc.
.....