L
Laurel
The code ibelow s executed in a command button. Frequently (more often than
not?) the function that references the recordset passed in the parameter
encounters a "No current record" in its first statement. But not always!
So the code can work. I can't figure out why it would sometimes recognize
the current record and not other times. I'm always sure that the cursor is
on a row in the forms recordset before clicking the command button.
I'd be most grateful if someone could help. I've worked on this all day,
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 tomorrow...
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 Then (NOTE - THIS CODE DOES NOT TRAP THE
PROBLEM.
HOW CAN THE FORM HAVE A CurrentRecord
HERE, BUT NOT IN THE
SUB THAT IS CALLED???)
MsgBox ("No current record" & vbCrLf & "Copy will not be done.")
Exit Sub
End If
Select Case optCopyControls
Case 1
Call subCopyScores1(lrstMe, irst_ClassPeriods)... 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.
.....
not?) the function that references the recordset passed in the parameter
encounters a "No current record" in its first statement. But not always!
So the code can work. I can't figure out why it would sometimes recognize
the current record and not other times. I'm always sure that the cursor is
on a row in the forms recordset before clicking the command button.
I'd be most grateful if someone could help. I've worked on this all day,
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 tomorrow...
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 Then (NOTE - THIS CODE DOES NOT TRAP THE
PROBLEM.
HOW CAN THE FORM HAVE A CurrentRecord
HERE, BUT NOT IN THE
SUB THAT IS CALLED???)
MsgBox ("No current record" & vbCrLf & "Copy will not be done.")
Exit Sub
End If
Select Case optCopyControls
Case 1
Call subCopyScores1(lrstMe, irst_ClassPeriods)... 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.
.....