Change output from check box to Y/N

Gavx

Registered User.
Local time
Today, 12:43
Joined
Mar 8, 2014
Messages
155
I have created a query and one of the columns of the output displays a check box because this is the data type of the underlying table.

I would like the query to output either Y or N rather than displaying the checkbox.

How would I do this?

thanks
 
Try the below:
Code:
SELECT ...,  IIf([YourFieldName]=-1,"Y","N") AS NewFieldName From YourTableName;
Else show the SQL-String
 
Here is the SQL string;
Note that the AirplaneTransport.IsInternational is the field that contains the checkbox.


SELECT BookingProduct.BookingID, [Surname] & ", " & [FirstName] AS FullName, Guest.GuestName, Product.ProductName, AirplaneTransport.FlightCode, AirplaneTransport.CTSArrivalTime, AirplaneTransport.CTSDepartTime, AirplaneTransport.IsInternational
FROM Customer INNER JOIN (Booking INNER JOIN ((ProductType INNER JOIN Product ON ProductType.ProductTypeID = Product.ProductTypeID) INNER JOIN (Guest INNER JOIN (AirplaneTransport RIGHT JOIN BookingProduct ON AirplaneTransport.ID = BookingProduct.PlaneDetails) ON Guest.GuestID = BookingProduct.GuestID) ON Product.ProductID = BookingProduct.ProductID) ON (Booking.BookingID = Guest.BookingID) AND (Booking.BookingID = BookingProduct.BookingID)) ON Customer.CustomerID = Booking.CustomerID
WHERE (((ProductType.ProductTypeID)=5 Or (ProductType.ProductTypeID)=6 Or (ProductType.ProductTypeID)=7))
ORDER BY BookingProduct.BookingID, ProductType.ProductTypeID;
 
Try the below:

SELECT BookingProduct.BookingID, [Surname] & ", " & [FirstName] AS FullName, Guest.GuestName, Product.ProductName, AirplaneTransport.FlightCode, AirplaneTransport.CTSArrivalTime, AirplaneTransport.CTSDepartTime, IIf([AirplaneTransport.IsInternational]=-1,"Y","N") AS NewFieldName FROM Customer INNER JOIN (Booking INNER JOIN ((ProductType INNER JOIN Product ON ProductType.ProductTypeID = Product.ProductTypeID) INNER JOIN (Guest INNER JOIN (AirplaneTransport RIGHT JOIN BookingProduct ON AirplaneTransport.ID = BookingProduct.PlaneDetails) ON Guest.GuestID = BookingProduct.GuestID) ON Product.ProductID = BookingProduct.ProductID) ON (Booking.BookingID = Guest.BookingID) AND (Booking.BookingID = BookingProduct.BookingID)) ON Customer.CustomerID = Booking.CustomerID
WHERE (((ProductType.ProductTypeID)=5 Or (ProductType.ProductTypeID)=6 Or (ProductType.ProductTypeID)=7))
ORDER BY BookingProduct.BookingID, ProductType.ProductTypeID;
 

Users who are viewing this thread

Back
Top Bottom