Hi,
I'm having a problem with some code (record set) I wrote. I want to check for members of a group to see if they have been absent for 30, 60 and 90 consecutive meetings (not calendar days).
Basically a person will have a record in the db for everyday a meeting took place. Their record will either have a "1" for attended or "2" for absent in the Attended column.
The main table has the columns Absent30, Absent60 and Absent90. I want to put a value of 30, 60 or 90 in that column if the person was absent for 30, 60 and 90 consecutive meetings (not calendar days).
[COLOR=red yellow]
The code I wrote below works, but it only looks at the very first record/memmber .[/color]
It takes the ID form the very first record and checks the whole table only for that ID and says if that person was absent. [COLOR=red yellow]How can I get this to work for all members/ID in the table?[/color]
I created a continuous form and placed this code in the “On Open” event and the “On Current” event. I’ve been beating myself over the head for over a week now to get it work correctly. Any help would be tremendously appreciated.
Here is the code I wrote. It does a record set on a query I wrote to sort the table by most recent date.
Thanks Janet
I'm having a problem with some code (record set) I wrote. I want to check for members of a group to see if they have been absent for 30, 60 and 90 consecutive meetings (not calendar days).
Basically a person will have a record in the db for everyday a meeting took place. Their record will either have a "1" for attended or "2" for absent in the Attended column.
The main table has the columns Absent30, Absent60 and Absent90. I want to put a value of 30, 60 or 90 in that column if the person was absent for 30, 60 and 90 consecutive meetings (not calendar days).
[COLOR=red yellow]
The code I wrote below works, but it only looks at the very first record/memmber .[/color]
It takes the ID form the very first record and checks the whole table only for that ID and says if that person was absent. [COLOR=red yellow]How can I get this to work for all members/ID in the table?[/color]
I created a continuous form and placed this code in the “On Open” event and the “On Current” event. I’ve been beating myself over the head for over a week now to get it work correctly. Any help would be tremendously appreciated.
Here is the code I wrote. It does a record set on a query I wrote to sort the table by most recent date.
Code:
Private Sub Form_Open(Cancel As Integer)
'absent 90 consecutive days code
Dim intErrCnt As Integer
Dim Absent90No As Integer
Dim Absent90Yes As Integer
Dim Absent90True As Integer
Set dbAB = CurrentDb
Set rstAbsent = dbAB.OpenRecordset("qryAbsent90")
'here I get the error "cant assign value to object"
Me.txtAbsent90.SetFocus
Me.txtAbsent90.Text = "0"
rstAbsent.MoveFirst
Do While rstAbsent.EOF = False
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'check for attended = no
If (YouthID = rstAbsent!YouthID And rstAbsent!Attended = 2) Then
Absent90No = Absent90No + 1
'here I just put in the number 5 for testing (will replace later with 90)
If Absent90No = 5 Then
Me.txtAbsent90.Value = 90
End If
'to here
Else
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'check for attended = Yes
If (YouthID = rstAbsent!YouthID And rstAbsent!Attended = 2) Then
Absent90Yes = Absent90Yes + 1
'to here
Else
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'if total records checked = 90 then stop
Absent90True = Absent90No + Absent90Yes
'here I just put in the number 10 for testing (will replace later with 90)
If Absent90True = 10 Then
Exit Sub
End If
rstAbsent.MoveNext
Loop
End Sub
Thanks Janet