473,472 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SQL Help (Please)

Hello to all the SQLers on the board,

I am looking for some assistance with what will no doubt prove to be a
terrible piece of code.

SELECT *
FROM ((((Assets AS a LEFT JOIN AssetTypes AS e ON a.AssetTypeNumber =
e.AssetTypeNumber)
LEFT JOIN Contacts AS c ON a.ContactNumber = c.ContactNumber)
LEFT JOIN Contacts AS d ON c.ContactParent = d.ContactNumber)
LEFT JOIN PATResults AS pr ON a.AssetNumber = pr.AssetNumber)
LEFT JOIN PATVisualResults AS pv ON pr.ResultNumber = pv.ResultNumber

(FIELDS)
{CONTACTSELECTION(d)}=[Contact Selection]
{Assets.AssetDescription}LIKE[Description]
{Assets.AssetManufacturer}LIKE[Manufacturer]
{Assets.AssetRoom}LIKE[Room]
{PATResults(pr).TestDate}>=[Tested From Date]
{PATResults(pr).TestDate}<=[Tested To Date]

I need to add a between condition to refine the result to a specified
date range that the end user will choose by means of a VB interface.

I was thinking of adding a line like

WHERE Date BETWEEN 'from date' AND 'to date'

to the bottom of the statement but no matter what I try I don't seem to
be able to get it to work, all I want is for the [Tested From Date] and
the [Tested To Date] to populate the BETWEEN condition.

Any help will be GREATFULLY received as at the moment I am pulling my
hair out.

Thanks in advance

Ross :)
Nov 13 '05 #1
1 1452
"Ross Winter" wrote
Hello to all the SQLers on the board,
WHERE Date BETWEEN 'from date' AND 'to date'


Date is the built-in function that returns the current date. Is that what
you want to test against the two Fields in your Record? Dates are not
strings... and are set off with # not single or double quotes, if at all.
Date/time type Fields in the Record most likely don't need to be set off at
all. Try

WHERE Date BETWEEN [Tested From Date] AND [Tested To Date]

if that does not work, try

WHERE Date BETWEEN #[Tested From Date]# AND #[Tested To Date]#

If you are building the statement in code, and need see where to put the
quote marks in the VBA expression, post back and someone may be able to
help.

Unless an SQL statement is trivially simple, I start with the Query
Builder -- I may simplify its output if I use that as a model for building
SQL in code.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #2

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

Similar topics

1
by: Numberwhun | last post by:
Hello everyone! I am trying to learn java and have run into kind of a snag. Here is the code that I have so far: ------ <begin_code> ---------- import javax.swing.*; import...
1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
0
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
4
by: fatboySudsy | last post by:
Hi, I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
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,...
1
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.