Oooooooooops....... forgot to mention that both ClassNo and the child field,
Attend_Status, are both TEXT fields.
Ooooopsss, forgot to mention that both ClassNo and the child table field,
Attend_Status, are TEXT fields.
How about.... (watch out for line wrap)
Private Sub cmdClassAttendance_Click()
On Error GoTo Err_cmdClassAttendance_Click
If
IsNull(IsNull(Forms![frmClasses]![sfrmClassesqrytblLink]![Attend_Status])
Then
'Do Some Action like a message box so users know what just happened
MsgBox "Nothing to do!", vbInformation, "Class Attendance"
Else
DoCmd.OpenReport "rptClassAttendance", acViewPreview, , "[ClassNo]=
'" & Me.ClassNo & "'"
End if
Exit_cmdClassAttendance_Click:
Exit Sub
HTH,
Gina Whipp
> Hello:
>
[quoted text clipped - 51 lines]
> Thanks,
> Robert
Robert T - 27 Sep 2006 19:11 GMT
Hi Gina:
That was a very cool suggestion, however, it doesn't solve our problem. It
makes me realize that I didn't explain the situation in enough detail.
We have two reports, a Class Attendance sheet that we print out with
everyone's name who is registered for the class. We pass that around during
the class so that everyone who attends can sign the attendance sheet.
However, if a student registers for the class and then cancels her/her
registration, we put the words "Student Canceled" in the Attend_Status field
because we want to keep a record indicating the student registered and
subseqently canceled.
So, when printing the Class Attendance sheet, we don't want to include
anyone who's already canceled. However, when printing the Class Report, we
want to include everyone in the report because we want to retain that
information. Did I explain this clearly?
Anyway, thanks to you, I was able to get the expression working, however, it
still printed the names of students who had the words, "Student Canceled" in
the Attend_Status field. That field was NOT Null so they should have been
excluded from the Class Attendance report. In the end, I got the report to
print but it's not solving our problem.
Here's the expression I used.
strWhere = "[ClassNo]= '" & Me.ClassNo & "' And
IsNull(Forms![frmClasses]![sfrmClassesqrytblLink]![Attend_Status])"
Robert T - 27 Sep 2006 19:51 GMT
Hi Gina:
I thought of another hopefully clearer and easier way to explain what we want.
We only want to print the names of students where
Attend_Status = "Registered"
I think that is a little clearer. We don't want anyone on the class
attendance sheet who canceled their registration.
Robert
Gina Whipp - 27 Sep 2006 20:29 GMT
Okay, I think I got it now...
Private Sub cmdClassAttendance_Click()
On Error GoTo Err_cmdClassAttendance_Click
If Forms![frmClasses]![sfrmClassesqrytblLink]![Attend_Status] =
"Registered" Then
DoCmd.OpenReport "rptClassAttendance", acViewPreview, , "[ClassNo]=
'" & Me.ClassNo & "'"
Else
'Do Some Action like a message box so users know what just happened
MsgBox "No-one registered!", vbInformation, "Class Attendance"
End if
Exit_cmdClassAttendance_Click:
Exit Sub
> Hi Gina:
>
[quoted text clipped - 9 lines]
>
> Robert
Robert T - 28 Sep 2006 12:56 GMT
Hello:
I finally found a way to get the report to print only those students who had
an attend_status of "registered" [as opposed to canceled].
The following did NOT work, it printed every student who was originally
registered for the class, even those who canceled.
strWhere = "[ClassNo]= '" & Me.ClassNo & "' And
IsNull(Forms![frmClasses]![sfrmClassesqrytblLink]![Attend_Status])"
For the life of me, I don't know why, but the following did exactly what we
wanted. It printed the names of those students who had an Attend_Status of
"registered" and it did not print the names of those students who had an
Attend_Status of "canceled".
strWhere = "[ClassNo]= '" & Me.ClassNo & "' And [Attend_Status]= 'Registered'"
Robert
Robert T - 28 Sep 2006 14:15 GMT
Hello:
This what I get for rushing, I pasted in the wrong "incorrect" expression in
the previous message, sorry about that. Even though I don't understand why
the previous attempt didn't work, here's the final solution.
Hello:
I finally found a way to get the report to print only those students who had
an attend_status of "registered" [as opposed to canceled].
The following did NOT work, it printed every student who was originally
registered for the class, even those who canceled.
strWhere = "[ClassNo]= '" & Me.ClassNo & "' And
[Forms]![frmClasses[![sfrmqrytblClasses]![Attend_Status]= 'Registered'"
For the life of me, I don't know why, but the following did exactly what we
wanted. It printed the names of those students who had an Attend_Status of
"registered" and it did not print the names of those students who had an
Attend_Status of "canceled".
strWhere = "[ClassNo]= '" & Me.ClassNo & "' And [Attend_Status]= 'Registered'"
Robert
Gina Whipp - 28 Sep 2006 21:18 GMT
I think I know why.. because I made the assumption the field was on a
subform but obviously it was not. Glad you got it working despite my
misinformation.
Gina Whipp
> Hello:
>
[quoted text clipped - 25 lines]
>
> Robert
Robert T - 29 Sep 2006 12:48 GMT
Hi Gina:
The field [Attend_Status] is in a subform. However, somewhere during this
problem solving session, I added the [Attend_Status] field to the query.
Robert