Union Query Format

  • Thread starter Thread starter DS
  • Start date Start date
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
 
Problem Solved, I formated each returned value in the function as opposed to
setting the fuction to a fromat type.
Thanks
DS
 
Yup, that's about the only way you can do it.

Be aware, though, that that converts your values to strings, not numbers.
 
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
OH OH, but maybe not it's just for display purposes in a listbox. I would
assume that this is ok?
Thanks
DS
 
Back
Top