Solved

Problem with delete SQL based on medium date type.

Posted on 2014-10-09
3
168 Views
Last Modified: 2014-10-09
Using MS Access 2007 I have the following delete SQL:

strDelete = "DELETE * FROM tblContractorSummary WHERE cn_hauldate < #" & Me!txtStart & "# AND cn_hauldate > #" & Me!txtEnd & "#;"
db.Execute (strDelete)

Open in new window


No error is thrown but no records get deleted either.

Where did I go wrong?

Thanks

PBLack
0
Comment
Question by:PBLack
  • 2
3 Comments
 

Author Comment

by:PBLack
ID: 40370941
OR not AND

Doh!
0
 

Author Comment

by:PBLack
ID: 40370946
I will leave it for others who get in the same fix
0
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40370948
This is correct. Cause your WHERE clause is (semantically) a contradiction. Thus always false.

You do a range check. Your condition requires that the same value is lesser then a test value and greater then a second test value.

As we can assume that txtStart <= txtEnd the result is always false.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question