View Full Version : How to show all records


AccessKurzo
10-29-2002, 11:27 AM
I have a text box that holds a Customer ID. If the user selects a customer from the combo, it writes the ID to this text box. I want a query to use this as the parameter, if it is blank, I want ALL records returned - How can this be done?

I know the query is easy if the user selects something, but what do I write in the text box if I want all records to show?

Thanks

Rob.Mills
10-29-2002, 11:53 AM
In the line below where you wrote the reference to the textbox write:

(Forms!FormName!TextBox) Is Null

AccessKurzo
10-29-2002, 12:01 PM
thanks for the reply

I tried this code:

If Me.FrameCust.Value = 1 Then
'all records
stDocName = "Accounts Receivable"
DoCmd.openReport stDocName, acPreview
Else
'by customer
stWhere = "[CustID] = " & Me.cboCustomer
stDocName = "Accounts Receivable"
DoCmd.openReport stDocName, acPreview, , stWhere
End If


and it works great - I never had a chance to try yours :)