i have a table called Customers
in that table i have a field call payments which is currency value
now when i enter a new cust then i insert also this value 0.00
i have some customers that have payments in this fields and some that not
how do i check if a customer has 0.00 in the payments table and then i can delete it?
if a customer dosnt have 0.00 which means he have payments then the customer cant be deleted.
i am using this code but not working very well
something is missing
in that table i have a field call payments which is currency value
now when i enter a new cust then i insert also this value 0.00
i have some customers that have payments in this fields and some that not
how do i check if a customer has 0.00 in the payments table and then i can delete it?
if a customer dosnt have 0.00 which means he have payments then the customer cant be deleted.
i am using this code but not working very well
something is missing
Code:
Dim rsD As ADODB.Recordset
Set rsD = New ADODB.Recordset
rsD.Open strSQL, CN, adOpenStatic, adLockOptimistic
strSQL = "SELECT PayMents FROM Customers Where ID = " & LsVw.SelectedItem.Tag
If rsD!PayMents = < 0.00 Then
MsgBox"This Customer has Payments in the system and he cannot be deleted at this time",vbInformation
rsD.Close
Else
If MsgBox("Delete This Customer? ", vbCritical + vbDefaultButton2 + vbYesNo, LsVw.SelectedItem.text) = vbNo Then Exit Sub
strSQL = "DELETE FROM Customers WHERE ID = " & LsVw.SelectedItem.Tag
CN.Execute strSQL
rsD.Close
Set rsD = Nothing
End If
End If