Solved

Problem with delete SQL based on medium date type.

Posted on 2014-10-09
3
163 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
Comment Utility
OR not AND

Doh!
0
 

Author Comment

by:PBLack
Comment Utility
I will leave it for others who get in the same fix
0
 
LVL 32

Accepted Solution

by:
Stefan Hoffmann earned 500 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now