View Full Version : Form IF statement


jevans
04-19-2001, 02:40 PM
Hello, My Customer Form lists all customer in the database. The fields are CUST-ID & CUSTOMER NAME. The CUST-ID has a DDL_Click event which opens Invoice Header Form and shows all outstanding invoices. My problem is show of the customers do not have invoices and the debugging window pops up. I need a IF statement, but I'm having trouble with the coding. Can anybody help me?

Jack Cowley
04-19-2001, 08:16 PM
I will assume that the invoice form that you are opening is based on a query. Code similar to this as the first part of the code in your dbl-click event should work:

If DCount("*","qryForInvoice", "[CUST-ID] = " & Me![CUST-ID]) <=0 Then
MsgBox "No Invoices for this customer"
Exit Sub
End If