Union Query Format

D

DS

I have a UNION Query that is giving me a Format problem.
Here is the Query.

With Forms!frmCheckPreview!ListOrders
..RowSource = "SELECT
tblCheckDetailsTMP.CDCheckID,tblCheckDetailsTMP.CDItemID, " & _
,IPRICE([CDQuantity],[CDPrice],[CDDiscountAmount],[CDDiscountPercent],[CDDiscountDP],[CDDiscountWhere],[CDTaxRate],[CDInclusive])
AS PRICE, " & _
"WHERE tblCheckDetailsTMP.CDCheckID = [Forms]![frmCheckAction]![TxtCheckID]
" & _
"AND tblCheckDetailsTMP.CDItemID >=41 " & _
"UNION " & _
"SELECT tblDiscountDetails.CDCheckID, tblblDiscountDetails.CDItemID, " & _
"DPRICE([CDDiscountDP],[CDDiscountAmount],[CDDiscountPercent]) AS PRICE, " &
_
"WHERE tblDiscountDetails.CDCheckID) = [Forms]![frmCheckAction]![TxtCheckID]
" & _
..ColumnCount = 3
..ColumnWidths = "0 in;0 in;.5 in"
..Requery
End With

The problem is the first query Price is always a currency format and the
second query can either be a currenct format or a percentage format. The
Functions are both set to be currency. If I make both functions a currency
type it's OK, but if the second query is a percent then I get an error
message type mismatch. How can I have the first query be a curency and the
second be either a currency or percent without receiving an error message?
Thanks
DS
 
D

DS

Problem Solved, I formated each returned value in the function as opposed to
setting the fuction to a fromat type.
Thanks
DS
 
D

Douglas J. Steele

Yup, that's about the only way you can do it.

Be aware, though, that that converts your values to strings, not numbers.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
D

DS

OH OH, but maybe not it's just for display purposes in a listbox. I would
assume that this is ok?
Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL ORDER BY 1
SQL Rowsource 1
Function Returns 0 3
OPEN ARGS Trouble 2
Not returning a value 7
Query iiF Woes 2
Sub-Query Problem 8
Form Reference 5

Top