VB/SQL using multiple criteria

Carl_R

Registered User.
Local time
Today, 03:09
Joined
Aug 16, 2002
Messages
82
Unfortunately, this is not giving me the desired result.
The groups are recognised but if I input the date to find all records with an exact match of '2003' I only receive two records with dates of '2004' (I know that there is one record for 2003 because I added it).

If I only have one group (no 'OR' operator) everything works just fine.

Not sure where I am going wrong... :confused:


Code:
 Case 2 'Select Year
        stSQL = "SELECT tblChanges.ChangeID, tblChanges.ClosedDate, tblChanges.Group, tblChanges.ProjectLead, tblChanges.System, tblChanges.ChangeProgram, tblChanges.Nature, tblChanges.UsersExposed, tblChanges.ImplementationDate, Year([ImplementationDate]) AS YearofTrans"
        stSQL = stSQL & " FROM tblChanges "
        stSQL = stSQL & " WHERE tblChanges.Group='OPEN' Or tblChanges.Group='CORE' Or tblChanges.Group='POST' and (Year([ImplementationDate]))= " & CInt(txtSelectDate)
 
(A OR B) AND C ?

A OR (B AND C) ?

You need to brakcet your AND and OR statements accordingly.
 
Cheers!

SJ McAbney said:
(A OR B) AND C ?

A OR (B AND C) ?

You need to brakcet your AND and OR statements accordingly.

That one turned what is left of my brain to mush... thanks for saving the ounce I have left ;)

Right, I will now have a beer in your honour.

Cheers!
 

Users who are viewing this thread

Back
Top Bottom