Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problem with delete SQL based on medium date type.

Posted on 2014-10-09
3
Medium Priority
?
175 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 36

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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

824 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