I have a report, in which is a field (txtInvoice) that may or may not need to be flagged based on a query (qry_FlagInvoice2). Basically, if that invoice # shows up in the query I want two icons (Flag1 and Flag2) to become visible. All of this is in a group header.
This works great if I only have one invoice number, but if I selected several from the list, the flag visibibility becomes all or nothing, for every invoice #.
How can I get the flag icons to appear only next to the invoices that are in the query, and not next to the ones that aren't?
Here is my code:
Private Sub Report_Load()
On Error GoTo err_handling
If Me.txtInvoice = DLookup("InvoiceNumber", "qry_FlagInvoice2") Then
Me.Flag1.Visible = True
Me.Flag2.Visible = True
Me.Flag1.Visible = False
Me.Flag2.Visible = False
MsgBox (Err.Number & Err.Description)