Hi

I am in the process of creating a maintenance scheduler for my company so that they can track any issues via a calendar style form.
I have managed to create the form and populate it with the relevant data. I have even managed to create a link so that when a date is selected, (if there is data in it) a report is generated to display any issues for that day.
Each day is seperated as a subform.

The problem I am having is if there isn't any data for the report to generate from.

I want to be able to open an input form when there is no data in the subform for a particular date. Unfortunately whenever I select a blank subform I get the error "You entered an expression that has no value"
Below is the code I am using for the onEnter events of the subforms.


Can anyone help?

Subform code
Code:
Private Sub SF5_Enter()
Dim SFdate As Boolean
If IsNull(Forms!frmcalmain.SF5) Then
SFdate = True
OpenCalRep SFdate, Forms!frmcalmain.SF5.Form!Date, Forms!frmcalmain.SF5.name
Else
SFdate = False
OpenCalRep SFdate, Forms!frmcalmain.SF5.Form!Date, Forms!frmcalmain.SF5.name
End If
End Sub
Function code
Code:
Private Sub OpenCalRep(SFNull As Boolean, date1 As Date, subformname As String)
If SFNull = True Then
DoCmd.OpenForm "maintenance1", , , , acFormAdd
Else
DoCmd.OpenReport "calendarreport", acViewPreview, , ("forms!frmcalmain." & subformname & ".form!date = maintenance.datedue")
End If

End Sub
Many Thanks

Jason[/img]