G
Guest
I've created a form (frmComboSearch) with combo boxes for various fields from
a table (tblMasterPartsList). After selecting the values from the combo
boxes, a query (qryComboSearch) is run using the data from the combo boxes.
This is all activated by a command button. What I'm trying to do is have a
new form open after the command button is pushed, instead of opening the
query. I've created a form (frmqryComboSearch) to display the query results,
and everything is working fine. The one problem i've run into is that I want
a dialogue box to pop up if there are no record matches for the query,
stating such, and giving the user a command button to return to the original
form with the combo boxes. So far, i've tried:
1. the On_Open Event in the second form (frmqryComboSearch):
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Sorry, there are no Parts that match your search criteria."
Cancel = True
End If
the dialogue pops up fine, but when it tries to go back to the original
form, i get the error message "Run-time error'2501': The OpenForm action was
canceled."
2. the On_Click Event of the command button in the first form
(frmComboSearch):
Private Sub cmdSearch_Click()
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Sorry, there are no Parts that match your search criteria."
Cancel = True
End If
DoCmd.OpenForm "frmqryComboSearch", acNormal
DoCmd.Close acForm, "frmComboSearch"
End Sub
Which returns the error message "Run-time error '7951': You entered an
expression that has an invalid reference to the RecordsetClone property."
I'm not sure what else to try... any help would be greatly appreciated!
a table (tblMasterPartsList). After selecting the values from the combo
boxes, a query (qryComboSearch) is run using the data from the combo boxes.
This is all activated by a command button. What I'm trying to do is have a
new form open after the command button is pushed, instead of opening the
query. I've created a form (frmqryComboSearch) to display the query results,
and everything is working fine. The one problem i've run into is that I want
a dialogue box to pop up if there are no record matches for the query,
stating such, and giving the user a command button to return to the original
form with the combo boxes. So far, i've tried:
1. the On_Open Event in the second form (frmqryComboSearch):
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Sorry, there are no Parts that match your search criteria."
Cancel = True
End If
the dialogue pops up fine, but when it tries to go back to the original
form, i get the error message "Run-time error'2501': The OpenForm action was
canceled."
2. the On_Click Event of the command button in the first form
(frmComboSearch):
Private Sub cmdSearch_Click()
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "Sorry, there are no Parts that match your search criteria."
Cancel = True
End If
DoCmd.OpenForm "frmqryComboSearch", acNormal
DoCmd.Close acForm, "frmComboSearch"
End Sub
Which returns the error message "Run-time error '7951': You entered an
expression that has an invalid reference to the RecordsetClone property."
I'm not sure what else to try... any help would be greatly appreciated!