Question : Union Select Problem

I have a continuous form with text fields on it that populates from a Union Query However some text boxe fields are bound to combobox fields in the original tables so therefore store the data as values. On the tables they are combo box fields so that the data returned is text
On the queries that the union query is based on they all return the text value but on the union select query it returns shows the content as a value.

If I build the union one table at a time and then view the finished union query it shows the field i require as text as text
If I then save the union it shows the field I require as text as a value.
This is annoying.
This is the SQL of the union query and the text box that I hope to return as a text value as opposed to a value is "ProductType"

SELECT QryProductsImports.ProductID,QryProductsImports.ProductName,QryProductsImports.ProductType,QryProductsImports.ChkArchive,QryProductsImports.UserID,QryProductsImports.ChkDeleted,QryProductsImports.Department FROM QryProductsImports
UNION SELECT QryProductsOwn.ProductID,QryProductsOwn.ProductName,QryProductsOwn.ProductType,QryProductsOwn.ChkArchive,QryProductsOwn.UserID,QryProductsOwn.ChkDeleted,QryProductsOwn.Department FROM QryProductsOwn
ORDER BY ProductName;


Any ideas on how this can be overcome would be appreciated.
btw the use of a combo box on the form is not an option for me as the field is enabled etc. and I don't want it to show a drop down list if it becomes active.

Answer : Union Select Problem

You can use the Choose function in a text box to translate a number to a text value.

=Choose(producttype,"one","two","three",....)


Alternatively:

=Switch(producttype=1,"Part1",producttype=2,"Part2",producttype=3,"Part3",producttype=4,"Part4,....)

The producttype does not have to be exactly sequential or ordered.  I could not find a limit to the number of switches allowed.
Random Solutions  
 
programming4us programming4us