View Single Post
  #7  
Old January 30th, 2009, 06:50 PM posted to microsoft.public.access.queries
Jey
external usenet poster
 
Posts: 27
Default help using a parameter in an 'In (...)' criteria

Hi,

OK, I got it to work. Thanks!

I don't understand why my three other parameters are in square brackets in
the WHERE clause, but for the survey list parameter it's the field name that
is in square brackets? Hmm, now that I look at the SQL more closely I also
don't understand why in the SELECT clause the table/field are as
[Table]![Field] but in the WHERE they are as (Table.Field). Are those two
formats interchangeable? maybe that's where my confusion is coming from?

Here is my SQL:

PARAMETERS parSurveyList Text ( 255 ), parHerd Long, parPreDate DateTime,
parPostDate DateTime;
SELECT Sum([GroupLocation]![AdultUnknown]+[GroupLocation]![Unknown]) AS
[Unknown]
FROM Survey INNER JOIN GroupLocation ON Survey.Survey_ID =
GroupLocation.Survey_ID
WHERE (((GroupLocation.Herd_ID)=[parHerd]) AND ((InStr("," & parSurveyList &
",","," & [SurveyType] & ","))0) AND ((GroupLocation.Date)[parPreDate] And
(GroupLocation.Date)[parPostDate]));