A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Return String from Boolean Field



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2004, 12:14 AM
Dragon
external usenet poster
 
Posts: n/a
Default Return String from Boolean Field

Hi,

I have the following query collecting data from a table where 'Complete'
field is a yes/no field. I am exporting this data for a PDF merge and what I
need is the Strings 'Yes' or 'Off' from the query results for this field
instead of a 0/1 value.

Any ideas?

Thank you.

SELECT Businesses.BusinessName AS Business, Businesses.Address AS Address,
Businesses.City AS City, Businesses.State AS State,
Businesses.Zip+Businesses.ZipPlus AS Zip, Businesses.DocumentNo,
Businesses.Complete
FROM Businesses
WHERE ((([Businesses].[Zip]+[Businesses].[ZipPlus])=99056));


  #2  
Old May 26th, 2004, 12:35 AM
fredg
external usenet poster
 
Posts: n/a
Default Return String from Boolean Field

On Tue, 25 May 2004 16:14:05 -0700, Dragon wrote:

Hi,

I have the following query collecting data from a table where 'Complete'
field is a yes/no field. I am exporting this data for a PDF merge and what I
need is the Strings 'Yes' or 'Off' from the query results for this field
instead of a 0/1 value.

Any ideas?

Thank you.

SELECT Businesses.BusinessName AS Business, Businesses.Address AS Address,
Businesses.City AS City, Businesses.State AS State,
Businesses.Zip+Businesses.ZipPlus AS Zip, Businesses.DocumentNo,
Businesses.Complete
FROM Businesses
WHERE ((([Businesses].[Zip]+[Businesses].[ZipPlus])=99056));


1) A Yes/No Check box field does not return a value of 0 or 1, it
returns a value of 0 or -1.


2) You asked for 0/1 Yes or Off? not 1/0 Yes or No?
Change the SQL to:

SELECT Businesses.BusinessName AS Business, Businesses.Address AS
Address,
Businesses.City AS City, Businesses.State AS State,
Businesses.Zip+Businesses.ZipPlus AS Zip, Businesses.DocumentNo,
IIf(Businesses.Complete = -1,"Off","Yes" as Completed
FROM Businesses
WHERE ((([Businesses].[Zip]+[Businesses].[ZipPlus])=99056));

Then use the [Completed] field in the export.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old May 26th, 2004, 08:08 PM
Dragon
external usenet poster
 
Posts: n/a
Default Return String from Boolean Field

Great. Thank you.

Yes, I did need 'Yes' and 'Off' :-)


"fredg" wrote in message
...
On Tue, 25 May 2004 16:14:05 -0700, Dragon wrote:

Hi,

I have the following query collecting data from a table where 'Complete'
field is a yes/no field. I am exporting this data for a PDF merge and

what I
need is the Strings 'Yes' or 'Off' from the query results for this field
instead of a 0/1 value.

Any ideas?

Thank you.

SELECT Businesses.BusinessName AS Business, Businesses.Address AS

Address,
Businesses.City AS City, Businesses.State AS State,
Businesses.Zip+Businesses.ZipPlus AS Zip, Businesses.DocumentNo,
Businesses.Complete
FROM Businesses
WHERE ((([Businesses].[Zip]+[Businesses].[ZipPlus])=99056));


1) A Yes/No Check box field does not return a value of 0 or 1, it
returns a value of 0 or -1.


2) You asked for 0/1 Yes or Off? not 1/0 Yes or No?
Change the SQL to:

SELECT Businesses.BusinessName AS Business, Businesses.Address AS
Address,
Businesses.City AS City, Businesses.State AS State,
Businesses.Zip+Businesses.ZipPlus AS Zip, Businesses.DocumentNo,
IIf(Businesses.Complete = -1,"Off","Yes" as Completed
FROM Businesses
WHERE ((([Businesses].[Zip]+[Businesses].[ZipPlus])=99056));

Then use the [Completed] field in the export.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.