Need help with ChkBox

  • Thread starter Thread starter David Ehrenreich
  • Start date Start date
D

David Ehrenreich

I have a chk box in a form I have for students that come
in our office. We check if then need any testing
accomadations. I would like a message box to appear if
they have ever had accomadations.

I know how to do this:

If isnull(DSS) = false Then
Msgbox "This Student has had prior DSS Services"

etc...

This would work for that record, but I need it to check
the whole table.

Any help would be great.

David Ehrenreich
 
David Ehrenreich said:
I have a chk box in a form I have for students that come
in our office. We check if then need any testing
accomadations. I would like a message box to appear if
they have ever had accomadations.

I know how to do this:

If isnull(DSS) = false Then
Msgbox "This Student has had prior DSS Services"

etc...

This would work for that record, but I need it to check
the whole table.

Any help would be great.

David Ehrenreich

Presumably the form is bound to a table that includes fields for a
Student ID of some sort and the DSS yes/no field. You need to look in
that table to see if there are any records for that StudentID wherein
DSS is True. The simplest approach is to use the DLookup function to do
this. Suppose the table is named, say, StudentServices. Then you might
have code like this:

If Not IsNull(DLookup("StudentID", "StudentServices", "DSS=True") _
Then
Msgbox "This Student has had prior DSS Services"
End If
 
Hello,

I was able to get it to sorta work. It seems that it's
showing the message box if their was a check in any of
the DSS feild insted of just ones associated with a
certain student ID.

Any thoughts?

Thank you so far
David Ehrenreich
-----Original Message-----
message news:[email protected]

Presumably the form is bound to a table that includes fields for a
Student ID of some sort and the DSS yes/no field. You need to look in
that table to see if there are any records for that StudentID wherein
DSS is True. The simplest approach is to use the DLookup function to do
this. Suppose the table is named, say,
StudentServices. Then you might
have code like this:

If Not IsNull(DLookup
("StudentID", "StudentServices", "DSS=True") _
 
David Ehrenreich said:
Hello,

I was able to get it to sorta work. It seems that it's
showing the message box if their was a check in any of
the DSS feild insted of just ones associated with a
certain student ID.

Any thoughts?

Yes, my thought is that I shouldn't post messages so late at night. I
left out the criterion on StudentID! It should be more like this:

If Not IsNull(DLookup("StudentID", "StudentServices", _
"DSS=True AND StudentID=" & Me.StudentID)) _
Then
Msgbox "This Student has had prior DSS Services"
End If

That assumes (a) the name of the field in the table is "StudentID", (b)
that field is included in the form's recordsource or is the name of a
control on the form, and (c) the field is numeric, not text. If
StudentID is a text field, you have to embed quotes surrounding it in
the criteria string, like this:

"DSS=True AND StudentID=" & _
Chr(34) & Me.StudentID & Chr(34))) _

Sorry about the oversight.
 
Back
Top