I have a subform (frmProgressReportSubform) linked to the parent form (frmIEPProgress) on StudentID. I'd like to have a message displayed on the subform when there are no records or the form is blank. The SQL for the subform is as follows:
SELECT tblIEP.IEP_ID, tblGoals.GoalID, tblIEP.IEPStartDate, tblIEP.MeetingDate, DateDiff("m",[IEPStartDate],Now()) AS StartDate, tblIEP.StudentID, [FirstName] & " " & [LastName] AS Student, tblGoals.Area, tblGoals.ProgressDate, tblGoals.GoalNum, tblGoals.MeasurableGoal,
tblGoals.FirstQuarterProgress, tblGoals.SecondQuarterProgress, tblGoals.ThirdQuarterProgress, tblGoals.FourthQuarterProgress, tblGoals.ProgressComments, StudentInformation.Inactive, tblIEP.InactiveIEP, tblGoals.TeacherGoal
FROM (StudentInformation INNER JOIN tblIEP ON StudentInformation.StudentID = tblIEP.StudentID) INNER JOIN tblGoals ON tblIEP.IEP_ID = tblGoals.IEP_ID
WHERE (((tblIEP.IEPStartDate)>=DateAdd("m",-14,Date()) And (tblIEP.IEPStartDate)<Date()) AND ((StudentInformation.Inactive)=False) AND ((tblIEP.InactiveIEP)=False) AND ((tblGoals.TeacherGoal)=[Forms]![frmIEPProgress]![chkTherapyGoals]) AND ((StudentInformation.SchoolBuilding)="Fairhaven"))
ORDER BY tblGoals.GoalID, tblIEP.MeetingDate DESC;
In the OnCurrent event of the subform I've tried:
Private Sub Form_Current()
If Not IsNull(Me.IEP_ID) Then
Me.txtMessage.Visible = True
Me.txtMessage = "There are record here too."
Else
Me.txtMessage.Visible = True
Me.txtMessage = "No teacher goals for this student."
End If
End Sub
which appears to be part way working, where if the subform displays records the first txtMessage is always displayed.
However if I flip it to this:
Private Sub Form_Current()
If IsNull(Me.IEP_ID) Then
Me.txtMessage.Visible = True
Me.txtMessage = "No teacher goals for this student."
Else
Me.txtMessage.Visible = True
Me.txtMessage = "There are records here."
End If
End Sub
The opposite effect seems to take place and only the second txtMessage is always displayed.
I just want my the txtMessage to display a message when the subform has no records.
Note: these are not the messages I want to display in the the unbound text box, but only to test to see what's happening.
Mike