[AccessD] SQL ANDs

Martin Caro mcaro at bigpond.net.au
Wed Jun 30 23:28:23 CDT 2004


Thanks Stuart, below is the SQL and it selects records depending on if one
or more components of the AND construct have values inserted. The first AND
will always have data (ie the date range and the TargetPestPlantID) but if
one (or more) of the remaining components are left vacant I do not want the
whole construct not to work.



Martin





SELECT....................etc



FROM dbo_ViewPWLocations



WHERE (((dbo_ViewPWLocations.ActivationDate) Between
[Forms]![frmReports]![RptStartDate] And [Forms]![frmReports]![rptEndDate])
AND
((dbo_ViewPWLocations.TargetPestPlantID)=[Forms]![frmReports]![TempPestID])
AND ((dbo_ViewPWLocations.PremiseTypeID)=[Forms]![frmReports]![rptPremise])
AND ((dbo_ViewPWLocations.InspectorID)=[Forms]![frmReports]![rptInspector])
AND
((dbo_ViewPWLocations.LocationTownCity)=[Forms]![frmReports]![rptSuburb]));


----- Original Message -----
From: "Stuart McLachlan" <stuart at lexacorp.com.pg>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Thursday, July 01, 2004 12:51 PM
Subject: Re: [AccessD] SQL ANDs


> On 1 Jul 2004 at 12:40, Martin Caro wrote:
>
> > Might have a problem there as I'm referencing Integer fields......
> >
>
> How about posting the actual SQL that does work if all the boxes are
selected,
> that will make it much easier to give you a working solution rather than
keep
> on finding out these extra points.
>
>
>
> --
> Lexacorp Ltd
> http://www.lexacorp.com.pg
> Information Technology Consultancy, Software Development,System Support.
>
>
>
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list