G
Guest
Hi there!
I want to restrict my users from running a query if there are records in a
second query. The second query has 2 parameters based on forms,
[Forms]![frmInvBusNums]![InventoryNum] and [Forms]![frmInvBusNums]![BusUnit]
The code I'm trying to run, which is totally wrong looks something like this:
Dim db As DAO.Database
' Dim rst As DAO.Recordset
'
' Set db = CurrentDb
'
'
' set rst=db.QueryDefs "Discrepancy_Report"
' If rst.RecordCount > 0 Then
' MsgBox "There are conflicts"
' Exit Sub
' Else
' do something
' End If
Alternatively, I tried to open the query like this:
' DoCmd.OpenQuery "Discrepancy_Report"
and then somehow find the number of records returned. Will this work or
should I try the solution above?
Thanks for your help!
I want to restrict my users from running a query if there are records in a
second query. The second query has 2 parameters based on forms,
[Forms]![frmInvBusNums]![InventoryNum] and [Forms]![frmInvBusNums]![BusUnit]
The code I'm trying to run, which is totally wrong looks something like this:
Dim db As DAO.Database
' Dim rst As DAO.Recordset
'
' Set db = CurrentDb
'
'
' set rst=db.QueryDefs "Discrepancy_Report"
' If rst.RecordCount > 0 Then
' MsgBox "There are conflicts"
' Exit Sub
' Else
' do something
' End If
Alternatively, I tried to open the query like this:
' DoCmd.OpenQuery "Discrepancy_Report"
and then somehow find the number of records returned. Will this work or
should I try the solution above?
Thanks for your help!