form1 OR form2 parmeter box problem

  • Thread starter Thread starter Lez
  • Start date Start date
L

Lez

Hi Guys,

I have a report that I want to use from 2 different forms and have added in
the criteria section:

[Forms].[frm1].[CustID]
or
[Forms].[frm2].[CustID]

The problem is if using either form a parameter box displays, although I can
cancel it I would prefer it to not show, can anyone help me with this please

TIA
 
--- UNTESTED ---
Try this as criteria --
IIf([Forms].[frm1].[CustID] Is Null, [Forms].[frm2].[CustID],
[Forms].[frm1].[CustID])
 
I would remove every possible dynamice criteria from the query. Use the Where
Condition of the DoCmd.OpenReport method to filter your report records.

Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.CustID) Then
strWhere = strWhere & " And [CustID]=" & Me.CustID
End If
DoCmd.OpenReport "rptCustomer..." , AcPreview, , strWhere
 
Back
Top