Solved

Problem with delete SQL based on medium date type.

Posted on 2014-10-09
3
165 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

911 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

22 Experts available now in Live!

Get 1:1 Help Now