G
G. Gray
I have a read-only form, with 4 selection fields. I use a customized toolbar
with Filter by Form and Apply Filter selections to bring up the results.
What I am trying to do is to display an error box msg, “No Record Foundâ€,
instead of a blank form when I input to 2 of the fields and the criteria does
not match. I have written the following code, using it in the Apply Filter
Event, but it does not work.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
On Err GoTo ApplyFilter_Err
Dim strProd As String
strProd = "[ProdNumber]" = "[ShelfID]![RowID]![ProdType]*"
If DCount("*", "Product Location", strProd) > 0 Then
DoCmd.OpenForm "Product Location", acNormal, "Product Location", ,
acFormReadOnly, acWindowNormal
Else
MsgBox "No Records Found", vbOKCancel
End If
ApplyFilter_Exit:
Exit Sub
ApplyFilter_Err:
MsgBox Error$
Resume ApplyFilter_Exit
End Sub
Your help would be much appreciated.
Thanks
G.Gray
with Filter by Form and Apply Filter selections to bring up the results.
What I am trying to do is to display an error box msg, “No Record Foundâ€,
instead of a blank form when I input to 2 of the fields and the criteria does
not match. I have written the following code, using it in the Apply Filter
Event, but it does not work.
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
On Err GoTo ApplyFilter_Err
Dim strProd As String
strProd = "[ProdNumber]" = "[ShelfID]![RowID]![ProdType]*"
If DCount("*", "Product Location", strProd) > 0 Then
DoCmd.OpenForm "Product Location", acNormal, "Product Location", ,
acFormReadOnly, acWindowNormal
Else
MsgBox "No Records Found", vbOKCancel
End If
ApplyFilter_Exit:
Exit Sub
ApplyFilter_Err:
MsgBox Error$
Resume ApplyFilter_Exit
End Sub
Your help would be much appreciated.
Thanks
G.Gray