Query issue (where cell populated aswell as any of the other listed cells)

chris-uk-lad

Registered User.
Local time
Today, 03:10
Joined
Jul 8, 2008
Messages
271
Hi,

I have a query im wanting to run on a table but i cant get the syntax to work with it.

Im trying to get it to display records where "Date" is populated, and any of the other cells listed in the query are populated (be that 1, 5 or all).

E.g Date ="01/01/01"

Name = ""
Surname = ""
MaidenName = "Johns"

So it will pick this up because it has MaidenName populated.
 
Before you resolve this issue the first thing you need to do is to change the name of the field "Date" to something different. Access uses this and as such it is known as a reserved word. Read up on reserved words and naming conventions.
 
i will heed this, and have Changed to DateJoined :)
 
Hi -

Adding to the advice re using Date as a field name, I'm presuming that your date field is in Date/Time data format -- not as Text as indicated in your example.

Re the query, try this, replacing table and field names to coincide with your table:

Code:
SELECT
    sdate
  , mymonth
  , myyear
  , edate
FROM
   tblDateTest3
WHERE
   ((Not (sdate) Is Null) 
AND
   (Not (mymonth) Is Null)) 
OR
   ((Not (myyear) Is Null)) 
OR
   ((Not (edate) Is Null));

HTH - Bob
 

Users who are viewing this thread

Back
Top Bottom