Re: SQL Syntax Error
- From: michelleumich <mahampto@xxxxxxxxx>
- Date: Fri, 06 Jul 2007 08:17:24 -0700
John,
Thank you for your help. I made a few errors earlier when working
with the code. I am still very new to SQL and code in general,
especially within Access. I fixed the Brackets and a few other
things. here is the newly adapted code:
PARAMETERS [Forms]![QueryMultiValueSearchForm]![txtFilterName] Long,
[Forms]![QueryMultiValueSearchForm]![txtFilterUMID] Long, [Forms]!
[QueryMultiValueSearchForm]![txtProjectGrant] Long;
SELECT [2007-08ScholarshipMaster].*
FROM [2007-08ScholarshipMaster]
WHERE IIf (([Forms]![QueryMultiValueSearchForm]![txtFilterName] Is
Null) ,
IIf([2007-08ScholarshipMaster].Name Like "*" & [Forms]!
[QueryMultiValueSearchForm]![txtFilterName] & "*"))
AND (([Forms]![QueryMultiValueSearchForm]![txtFilterUMID] Is Null)
OR ([2007-08ScholarshipMaster].UMID = [Forms]!
[QueryMultiValueSearchForm]![txtFilterUMID]))
AND (([Forms]![QueryMultiValueSearchForm]![txtProjectGrant] Is
Null)
OR ([2007-08ScholarshipMaster].ProjectGrant = [Forms]!
[QueryMultiValueSearchForm]![txtProjectGrant]))
AND (([Forms]![QueryMultiValueSearchForm]![txtStartDate] Is Null)
OR ([2007-08ScholarshipMaster].ScholarshipStart Like "*" & [Forms]!
[QueryMultiValueSearchForm]![txtStartDate] & "*"))
AND (([Forms]![QueryMultiValueSearchForm]![txtEndDate] Is Null)
OR ([2007-08ScholarshipMaster].ScholarshipEnd Like "*" & [Forms]!
[QueryMultiValueSearchForm]![txtEndDate] & "*"))
I'm going to try to answer your questions about what I think the
statements are doing to the best of my knowledge but I have altered
this code pretty significantly from the original that I found so most
likely I have created some type of syntax error. Basically, I am
trying to create a Query search (So I can use a Print macro) in which
I can enter partial entries and leave some boxes null without it
affecting the search. I think I messed up the "where" statement,
becuase There were other lines of code that had a similar format so I
deleted them and moved other lines up. I realize now that most likely
The syntax for the "where" statement is incorrect becuase of this. If
you would like to see the original code I would be more than happy to
post. To Marshall: thanks for your input, I just checked the spacing
in the parameter clause and it is just fine. To Kingston: If string
comparisons use "or" as a text qualifier does that mean I should
change all my AND statements to OR? This SQL statement is being used
as a Query itself.
Thanks,
M
.
- Follow-Ups:
- Re: SQL Syntax Error
- From: John Spencer
- Re: SQL Syntax Error
- References:
- SQL Syntax Error
- From: michelleumich
- Re: SQL Syntax Error
- From: John Spencer
- SQL Syntax Error
- Prev by Date: Re: adding new records from one table to an existing table
- Next by Date: Re: SQL Syntax Error
- Previous by thread: Re: SQL Syntax Error
- Next by thread: Re: SQL Syntax Error
- Index(es):
Relevant Pages
|