Can you use dLookup to look into a table if a record in it doesnt exist?
A summary of what im trying to do.
The admin guy can view a invoice and its breakdown, there may be many invoices for each application. In the form footer is a button that allows the admin to make a payment ( insert sql into payments table)
What i want is for code to check if that particular invoice has been paid, if it has show a label stating so, if not show the payment button.
Ive been trying this but receive error 3464.
Dim iInvoice As String
iInvoice = Me.invoices_id
Dim iResult As Variant
iResult = Nz(DLookup("[payment_amt]", "temp_payments_table", "[Invoice_id] = '" & iInvoice & "' "))
If iResult > 0 Then
Me!sub_payments_invoice_works.Form!sub_payment_works_total!Form!lblPaid.Visible = True
Else
Me!sub_payments_invoice_works.Form!sub_payment_works_total!Form!cmdPayment.Visible = True
End If
Ive only really experimented with dlookup yesterday so relativly new to me, can you include NZ with it? How can i fix my problem, thanks.
A summary of what im trying to do.
The admin guy can view a invoice and its breakdown, there may be many invoices for each application. In the form footer is a button that allows the admin to make a payment ( insert sql into payments table)
What i want is for code to check if that particular invoice has been paid, if it has show a label stating so, if not show the payment button.
Ive been trying this but receive error 3464.
Dim iInvoice As String
iInvoice = Me.invoices_id
Dim iResult As Variant
iResult = Nz(DLookup("[payment_amt]", "temp_payments_table", "[Invoice_id] = '" & iInvoice & "' "))
If iResult > 0 Then
Me!sub_payments_invoice_works.Form!sub_payment_works_total!Form!lblPaid.Visible = True
Else
Me!sub_payments_invoice_works.Form!sub_payment_works_total!Form!cmdPayment.Visible = True
End If
Ive only really experimented with dlookup yesterday so relativly new to me, can you include NZ with it? How can i fix my problem, thanks.