D
DebbieG
I have a form based on this query:
SELECT Students.LastSerDT, OtherInfo.Served, OtherInfo.HSGradYr,
OtherInfo.ActivePart, OtherInfo.Served, Students.SSN, [LastNM] & ", " &
[FirstNM] & " " & [MI] AS Name, Students.LastNM, Students.FirstNM,
Students.MI, Students.DOB, Students.GenderCD, Students.EthnicityCD,
Students.EligibilityCD, Students.UBInitiative, Students.NCESSchID,
Students.ProjEntryDT, Students.ProjReEntDT, Students.LastSerDT,
Students.Reason, Students.PartCD, Students.PartLV, Students.NeedCD,
Students.AssessCD, Students.PSAT, Students.PLAN, Students.EnterGradeLV,
Students.EndGradeLV, Students.EntryGPAScale, Students.CumGPAEntry,
Students.EndGPAScale, Students.HSGPA1, Students.HSGPA2, Students.CollExamCD,
OtherInfo.NCESSchNM, OtherInfo.MiddleNM, OtherInfo.CurrentGradeLV,
OtherInfo.CurrentHSNM, Students.PicturePath
FROM Students LEFT JOIN OtherInfo ON Students.SSN = OtherInfo.SSN
WHERE (((Students.LastSerDT) Is Null)) OR (((OtherInfo.Served)=Yes)) OR
((([Forms]![frmStudents]![CheckCriteria])=Yes))
ORDER BY Students.LastNM, Students.FirstNM;
If [Forms]![frmStudents]![CheckCriteria]=No then it shows records WHERE
Students.LastSerDT Is Null OR OtherInfo.Served=Yes. (This is the default
when the form is opened.) If [Forms]![frmStudents]![CheckCriteria]=Yes then
it shows every record. It works just like I wanted.
When I click the CheckCriteria checkbox this is called:
Private Sub CheckCriteria_Click()
'if checkbox = yes then shows all students, else shows current/active
Me.Requery
Me.ComboStudent.Requery
ShowName = ComboStudent.Column(2)
End Sub
The ComboStudent combobox gets its information from the same query so that
it shows the correct records.
However, now the user wants the option of showing students with a particular
HSGradYr. I have added a textbox called txtGradYear to my form for the user
to enter a year, but I don't know where to go from here.
I'm basically wanting this one query to act in 3 different ways.
1. WHERE Students.LastSerDT Is Null OR OtherInfo.Served=Yes
2. WHERE [Forms]![frmStudents]![CheckCriteria]=Yes
3. WHERE OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear]
And I want the ComboStudent to display the appropriate entries for each
WHERE.
I've got it working the first 2 ways, but I cannot figure out how to get the
3rd way to work. I tried:
WHERE (Students.LastSerDT Is Null OR OtherInfo.Served=Yes) OR
([Forms]![frmStudents]![CheckCriteria]=Yes) OR
(OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear])
but I didn't get JUST the records where
OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear] which makes sense.
Can anyone help me get what I need?
Thanks in advance,
Debbie
SELECT Students.LastSerDT, OtherInfo.Served, OtherInfo.HSGradYr,
OtherInfo.ActivePart, OtherInfo.Served, Students.SSN, [LastNM] & ", " &
[FirstNM] & " " & [MI] AS Name, Students.LastNM, Students.FirstNM,
Students.MI, Students.DOB, Students.GenderCD, Students.EthnicityCD,
Students.EligibilityCD, Students.UBInitiative, Students.NCESSchID,
Students.ProjEntryDT, Students.ProjReEntDT, Students.LastSerDT,
Students.Reason, Students.PartCD, Students.PartLV, Students.NeedCD,
Students.AssessCD, Students.PSAT, Students.PLAN, Students.EnterGradeLV,
Students.EndGradeLV, Students.EntryGPAScale, Students.CumGPAEntry,
Students.EndGPAScale, Students.HSGPA1, Students.HSGPA2, Students.CollExamCD,
OtherInfo.NCESSchNM, OtherInfo.MiddleNM, OtherInfo.CurrentGradeLV,
OtherInfo.CurrentHSNM, Students.PicturePath
FROM Students LEFT JOIN OtherInfo ON Students.SSN = OtherInfo.SSN
WHERE (((Students.LastSerDT) Is Null)) OR (((OtherInfo.Served)=Yes)) OR
((([Forms]![frmStudents]![CheckCriteria])=Yes))
ORDER BY Students.LastNM, Students.FirstNM;
If [Forms]![frmStudents]![CheckCriteria]=No then it shows records WHERE
Students.LastSerDT Is Null OR OtherInfo.Served=Yes. (This is the default
when the form is opened.) If [Forms]![frmStudents]![CheckCriteria]=Yes then
it shows every record. It works just like I wanted.
When I click the CheckCriteria checkbox this is called:
Private Sub CheckCriteria_Click()
'if checkbox = yes then shows all students, else shows current/active
Me.Requery
Me.ComboStudent.Requery
ShowName = ComboStudent.Column(2)
End Sub
The ComboStudent combobox gets its information from the same query so that
it shows the correct records.
However, now the user wants the option of showing students with a particular
HSGradYr. I have added a textbox called txtGradYear to my form for the user
to enter a year, but I don't know where to go from here.
I'm basically wanting this one query to act in 3 different ways.
1. WHERE Students.LastSerDT Is Null OR OtherInfo.Served=Yes
2. WHERE [Forms]![frmStudents]![CheckCriteria]=Yes
3. WHERE OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear]
And I want the ComboStudent to display the appropriate entries for each
WHERE.
I've got it working the first 2 ways, but I cannot figure out how to get the
3rd way to work. I tried:
WHERE (Students.LastSerDT Is Null OR OtherInfo.Served=Yes) OR
([Forms]![frmStudents]![CheckCriteria]=Yes) OR
(OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear])
but I didn't get JUST the records where
OtherInfo.HSGradYr=[forms]![frmStudents]![txtGradYear] which makes sense.
Can anyone help me get what I need?
Thanks in advance,
Debbie