S
SoggyCashew
Hello I have a function that is giving me an error "Inproper use of null" I
am running this to verify there is data in a query named qryQearView and if
there isnt then it exits function and sets focus to a text box. What am I
doing wrong?
Private Function ShowReport(ByVal RName As String)
Dim Emp As String
Dim datYr As String
Emp = Forms!frmCalendar!cboUser.Column(2)
datYr = Forms!frmCalendar!CalYear
If DCount("*", "qryYearView", "") = 0 Then
MsgBox "There is no attendance data for " & Emp & " in the year " &
datYr & Chr(13) & _
"" & Chr(13) & _
"The calendar can only be viewed if data is available!", vbCritical, "No
Data Error"
Exit Function
End If
If Me.cboDepartment.ListIndex = "-1" Then
MsgBox "You must make sure yor criteria's" & Chr(13) & _
"are selected in before proceeding." & Chr(13) & _
"" & Chr(13) & _
" - Please select a Branch" & Chr(13) & _
" - Please select a Department" & Chr(13) & _
" - Please select an Employee", vbCritical, "Selection Error"
Me.cboDepartment.SetFocus
Exit Function
End If
If Me.cboUser.ListIndex = "-1" Then
MsgBox "You must make sure yor criteria's" & Chr(13) & _
"are selected in before proceeding." & Chr(13) & _
"" & Chr(13) & _
" - Please select a Branch" & Chr(13) & _
" - Please select a Department" & Chr(13) & _
" - Please select an Employee", vbCritical, "Selection Error"
Me.cboUser.SetFocus
Exit Function
Else
DoCmd.OpenReport RName, acPreview
End If
End Function
am running this to verify there is data in a query named qryQearView and if
there isnt then it exits function and sets focus to a text box. What am I
doing wrong?
Private Function ShowReport(ByVal RName As String)
Dim Emp As String
Dim datYr As String
Emp = Forms!frmCalendar!cboUser.Column(2)
datYr = Forms!frmCalendar!CalYear
If DCount("*", "qryYearView", "") = 0 Then
MsgBox "There is no attendance data for " & Emp & " in the year " &
datYr & Chr(13) & _
"" & Chr(13) & _
"The calendar can only be viewed if data is available!", vbCritical, "No
Data Error"
Exit Function
End If
If Me.cboDepartment.ListIndex = "-1" Then
MsgBox "You must make sure yor criteria's" & Chr(13) & _
"are selected in before proceeding." & Chr(13) & _
"" & Chr(13) & _
" - Please select a Branch" & Chr(13) & _
" - Please select a Department" & Chr(13) & _
" - Please select an Employee", vbCritical, "Selection Error"
Me.cboDepartment.SetFocus
Exit Function
End If
If Me.cboUser.ListIndex = "-1" Then
MsgBox "You must make sure yor criteria's" & Chr(13) & _
"are selected in before proceeding." & Chr(13) & _
"" & Chr(13) & _
" - Please select a Branch" & Chr(13) & _
" - Please select a Department" & Chr(13) & _
" - Please select an Employee", vbCritical, "Selection Error"
Me.cboUser.SetFocus
Exit Function
Else
DoCmd.OpenReport RName, acPreview
End If
End Function