Link to home
Create AccountLog in
Avatar of KLM56

asked on

Help with delete query

It's me again. I have manage to delete records from an access table using an excel userform using the code below. But the only way I am able do so if all fields have a value it it.  So I have a date field and about 6 other numeric fields. When I search for a record, it may not have a value in one of the fields. If it doesn't before I can delete it, I would need to replace the blank fields with a 0, update it, then I can delete the record. How can I delete the record regardless of blank fields or not.

strDelete = "Delete from tblMsrTotals Where businessDate = #" & txtbusinessDate.Text & "# and advances = " & txtadvances.Text & " and advanceAmount = " & txtadvanceAmount.Text & " and denied = " & txtdenied.Text & " and stopPayments = " & txtstopPayments.Text & " and branchLoc = " & txtbranchLoc.Text & " and cpg = " & txtCpg.Text & ""

Open in new window

Avatar of Lee Wadwell
Lee Wadwell
Flag of Australia image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of KLM56


Thank you. I decided to take your advice and define default value of 0 to the table. That works for me. The other suggestions seem a bit indimidating.