473,440 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

SQL code not returning correct data

Hello,

I have an access sql code with dates between #10/25/2005# and
#11/04/2005#. In addition, I have an "OR". I am getting records past
11/04/2005. How can I structure the code to eliminate records past
11/04/2005? Here is my code:

SELECT tblAllSurvey.Inst1_ID, tblAllSurvey.Inst2_ID,
tblAllSurvey.Inst3_ID, Left([SessionDate],10) AS ss, tblAllSurvey.Q21
FROM tblAllSurvey
WHERE (((tblAllSurvey.Inst1_ID)=40) AND ((Left([SessionDate],10))
Between #10/21/2005# And #11/4/2005#) AND ((tblAllSurvey.Q21) Is Not
Null)) OR (((tblAllSurvey.Inst2_ID)=40) AND ((Left([SessionDate],10))
Between #10/21/2005# And #11/4/2005#) AND ((tblAllSurvey.Q21) Is Not
Null));

Thanks in advance for your help.

Edgar

Dec 1 '05 #1
1 1290
Edgar wrote:
Hello,

I have an access sql code with dates between #10/25/2005# and
#11/04/2005#. In addition, I have an "OR". I am getting records past
11/04/2005. How can I structure the code to eliminate records past
11/04/2005? Here is my code:

SELECT tblAllSurvey.Inst1_ID, tblAllSurvey.Inst2_ID,
tblAllSurvey.Inst3_ID, Left([SessionDate],10) AS ss, tblAllSurvey.Q21
FROM tblAllSurvey
WHERE (((tblAllSurvey.Inst1_ID)=40) AND ((Left([SessionDate],10))
Between #10/21/2005# And #11/4/2005#) AND ((tblAllSurvey.Q21) Is Not
Null)) OR (((tblAllSurvey.Inst2_ID)=40) AND ((Left([SessionDate],10))
Between #10/21/2005# And #11/4/2005#) AND ((tblAllSurvey.Q21) Is Not
Null));

Thanks in advance for your help.

Edgar

Don't compare a date to a string would be my first response. If
SessionDate is a string, see CDate in help.
Dec 1 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
26
by: Michael Strorm | last post by:
Hi! I posted a message a while back asking for project suggestions, and decided to go with the idea of creating an adventure game (although it was never intended to be a 'proper' game, rather an...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
7
by: pmatos | last post by:
Hi all, I've been having questions about strings, references, initializations... I've created code (which will not compile due to a reference problem) and I'd like comments on why this won't...
1
by: john | last post by:
Relatively new to C coding, so any help would greatly be appreciated. I'm having problems try to return my string array from my parsing function. When I do a printf I am getting the correct value...
3
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released...
7
by: jammie_linux | last post by:
Hi, Please look at the following code. In my opinion, the value of "char *str" in the main function should not change even after calling the function "funct" and that's beacuse the "char *str" in...
10
by: Martin Jørgensen | last post by:
Hi, I got this piece of code, but I won't compile: #include <iostream> using namespace std; //////////////////////////////////////////////////////////////// struct link ...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: anuptosh | last post by:
Hi, I have been trying to run the below example to get a Oracle Array as an output from a Java code. This is an example I have found on the web. But, the expected result is that the code should...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.