RandyMyers
IS-IT--Management
Ok, here is a challenge...
I have a search form where various criteria can be entered...
The results are listed in a form for review and the user can click on a record to open the work order on that particular record. All works fine.
What I would like is if there are no records that meet the matching criteria for the system to display a message that there are no records that match the entered criteria and then return them to the search form...
Here is the code that is on the OK button of the criteria search popup form....
Private Sub Command31_Click()
On Error GoTo WorkOrdersFilter_Err
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Null And ([Forms]![frmWorkOrdersSearch]![Open]=0 Or [Forms]![frmWorkOrdersSearch]![Open] Is Null)")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilter", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Null And [Forms]![frmWorkOrdersSearch]![Open]=-1")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterOpen", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Not Null And ([Forms]![frmWorkOrdersSearch]![Open]=0 Or [Forms]![frmWorkOrdersSearch]![Open] Is Null)")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterDate", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Not Null And [Forms]![frmWorkOrdersSearch]![Open]=-1")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterOpenDate", "", , acNormal
End If
' Close the main menu
Form_frmMainMenu.Visible = False
WorkOrdersFilter_Exit:
Exit Sub
WorkOrdersFilter_Err:
MsgBox Error$
Resume WorkOrdersFilter_Exit
End Sub
Any ideas..... I have been trying to play with the RecordCount property, but I have not had any success....
I have a search form where various criteria can be entered...
The results are listed in a form for review and the user can click on a record to open the work order on that particular record. All works fine.
What I would like is if there are no records that meet the matching criteria for the system to display a message that there are no records that match the entered criteria and then return them to the search form...
Here is the code that is on the OK button of the criteria search popup form....
Private Sub Command31_Click()
On Error GoTo WorkOrdersFilter_Err
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Null And ([Forms]![frmWorkOrdersSearch]![Open]=0 Or [Forms]![frmWorkOrdersSearch]![Open] Is Null)")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilter", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Null And [Forms]![frmWorkOrdersSearch]![Open]=-1")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterOpen", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Not Null And ([Forms]![frmWorkOrdersSearch]![Open]=0 Or [Forms]![frmWorkOrdersSearch]![Open] Is Null)")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterDate", "", , acNormal
End If
If (Eval("[Forms]![frmWorkOrdersSearch]![StartDate] Is Not Null And [Forms]![frmWorkOrdersSearch]![Open]=-1")) Then
' Open the work orders filtered screen
DoCmd.OpenForm "frmWorkOrdersFilter", acNormal, "qryWorkOrdersFilterOpenDate", "", , acNormal
End If
' Close the main menu
Form_frmMainMenu.Visible = False
WorkOrdersFilter_Exit:
Exit Sub
WorkOrdersFilter_Err:
MsgBox Error$
Resume WorkOrdersFilter_Exit
End Sub
Any ideas..... I have been trying to play with the RecordCount property, but I have not had any success....