D
David
I have a form with a query as a record source. I am trying to figure out how
to evaluate if the query returns any records or zero records. I have
included by failed attempts. The first IF statement is what I am having
problems with. What logic can I use to determine zero records returned from
source query?
'*********** Form on OPEN event **********
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
'If Len(Me.frm_Verify_No_In_Status.SourceObject) = 0 Then
'If Me.RecordSourceQualifier = 0 Then
If IsNull(Me.Test_Case_Path) Then
MsgBox "All Test Cases Are Available"
DoCmd.Close acForm, Me.Name
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Add_Test_Cases"
DoCmd.OpenQuery "qry_Check_In_New"
DoCmd.OpenQuery "qry_Add_Test_Cases_History"
DoCmd.OpenQuery "qry_Check_In_New_History"
DoCmd.Close acForm, Me.Name
Forms!frm_Input_Test_Case.frm_Status.Requery
DoCmd.SetWarnings True
Else
MsgBox "You have attempted to " & Me.Status & " test cases that are
already " & Me.Status
Exit Sub
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open
End Sub
to evaluate if the query returns any records or zero records. I have
included by failed attempts. The first IF statement is what I am having
problems with. What logic can I use to determine zero records returned from
source query?
'*********** Form on OPEN event **********
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
'If Len(Me.frm_Verify_No_In_Status.SourceObject) = 0 Then
'If Me.RecordSourceQualifier = 0 Then
If IsNull(Me.Test_Case_Path) Then
MsgBox "All Test Cases Are Available"
DoCmd.Close acForm, Me.Name
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Add_Test_Cases"
DoCmd.OpenQuery "qry_Check_In_New"
DoCmd.OpenQuery "qry_Add_Test_Cases_History"
DoCmd.OpenQuery "qry_Check_In_New_History"
DoCmd.Close acForm, Me.Name
Forms!frm_Input_Test_Case.frm_Status.Requery
DoCmd.SetWarnings True
Else
MsgBox "You have attempted to " & Me.Status & " test cases that are
already " & Me.Status
Exit Sub
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open
End Sub