Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT statement return TRUE of FALSE 2

Status
Not open for further replies.

Genotix

Programmer
Dec 16, 2004
53
NL
Hi All,

I was wondering if you could help me out with this one.

I'm aware of the fact that you can merge cells by using a command like :
Code:
 SELECT ...., (Time & " on " & Date) As TimeDate From TableName

What I would like for an output is a variable that contains a check wether a field is NULL or filled with data.
Something like :
Code:
 SELECT ...., (RETURN False IF Date IS NULL) As Finished From TableName

Is this possible? [ponder]

Linux IS userfriendly.
It's only very selective about who it's friends are.
 
How about.....
SELECT ...., iif(isnull(yourdatefield),false,true) AS Finished FROM Tablename


Randy
 
You can use the IsNull function and Not operator, something like:
Code:
SELECT IDField, DateField, Not IsNull([DateField]) AS MyFlag
FROM MyTable;
Then you'll have a column called Flag with -1 (i.e. True) in if the field is not null and 0 (i.e. False) if the field tested is null.

You can even use formatting in whatever query/form/report you use this SQL in to make the -1/0 display as True/False or Yes/No, etc.

Hope this helps.

[pc2]
 
Thanx guy's, this works like a charm!

Linux IS userfriendly.
It's only very selective about who it's friends are.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top