I have some code that i supposed to check that a payment responsibility id has been set.
Code:
Me.Refresh
Dim TestNum As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryValidatePaymentRespID")
If rst.RecordCount > 0 Then
TestNum = 1
MsgBox "You have unassigned Line items, please exit and complete all line items"
Exit Sub
Else
TestNum = 0
End If
The sql for qryValidatePaymentRespId is
SELECT tbl_ImportedRepairs.BillingInvoiceID, tbl_ImportedRepairs.PaymentRespID
FROM tbl_ImportedRepairs
WHERE (((tbl_ImportedRepairs.BillingInvoiceID)=[Forms]![frmApproveInvoice]![BillingInvoiceID]) AND ((tbl_ImportedRepairs.PaymentRespID) Is Null));
My thought is that if there are is more than 0 records where the PaymentRespId is not set it will give the message and exit the sub.
Instead all I get is Run-Time error 3061 Too few parameters. Expected 1.