Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with delete SQL based on medium date type.

Posted on 2014-10-09
3
Medium Priority
?
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 35

Accepted Solution

by:
ste5an earned 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

721 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