Form IF statement

jevans

Registered User.
Local time
Today, 11:33
Joined
Oct 11, 2000
Messages
23
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?
 
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
 

Users who are viewing this thread

Back
Top Bottom