Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Union Query Format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 27 May 2008 20:02 GMT
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
DS - 27 May 2008 20:08 GMT
Problem Solved, I formated each returned value in the function as opposed to
setting the fuction to a fromat type.
Thanks
DS
Douglas J. Steele - 27 May 2008 20:29 GMT
Yup, that's about the only way you can do it.

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

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Problem Solved, I formated each returned value in the function as opposed
> to setting the fuction to a fromat type.
> Thanks
> DS
Jan Baird - 27 May 2008 20:52 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
DS - 28 May 2008 04:20 GMT
OH OH, but maybe not it's just for display purposes in a listbox.  I would
assume that this is ok?
Thanks
DS
Jan Baird - 27 May 2008 20:52 GMT
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 - 27 May 2008 20:52 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.