I have a query that returns several calculated fields. One of them is simply derived by simple summation of the others. If this calculated field returns a negative number, I need it to show as a zero.
The only way I know how to do this is by an IIF statement :
Code: SELECT [fld1], [fld2], [fl3], ..... IIF(([fld1]-[fld2]-fld[3])<0,0,([fld1]-[fld2]-fld[3])) AS fld4 FROM...
(The above doesn't suggest that [fld1], [fld2] etc are calculated fields - I just wrote it like that for succintness - they calculate fine, there's no issue with them...)
Is there a more efficient way of doing this? I find IIF's a bit tardy, possibly because they evaluate for both True & False eventualities, regardless of the condition, and this query is going to run against a fairly large dataset so any performance lag is going to be exacerbated.
I try to modify an access 2010 template from the MS website.The problem is that the template as is programmed does not accept as input negative prices. I need to use negative prices for offering discounts on my invoices. In my country the discounts are only displayed as products with negative prices/values. We do not use % discounts.
i try to create an products with negative price and to use it as an discount on the invoice. Both the products input form and the invoice input form give me the same error : "please specify an price list that is not negative" or "please specify non zero positive prices" ( sometimes it allow me to enter but when the software try to validate the form/invoice i just entered it give me those error/messages)
I changed all the field from currency in general numbers Where do I have to change in order to remove those formatting/condition..? The template has a lot of macros.. I an not able to change those macros if there are some formatting conditions in them. If it is allowed I will post the link to the free template i use to be more conclusive..Or I can give/ upload the template I use. the link to my data base ( dropbox)
Due to the data requirements a negative value is not acceptable, it needs to be zero. The above is part of an Asset Managemnt Program and if the WDCC (Written Down Current Cost) is 0 then the item is written off. How do I change the negative value to a zero. Any comments or suggestions would be appreciated.
I have a database which gathers and stores the odometer readings of our company vehicles every month. I have built a simple report with columns for Vehicle Number, Employee Number, Employee Name, Month, and Odometer Reading. My boss wants a field for each employee which compares the records for the last two months and displays the difference (i.e. the number of kilometers travelled in that month) /
I have a report that has four fields: Item, Qty, Price and TotalPrice for each line in the detail section. Total Price is calculated by multiplying Qty x Price. The text box name that holds the Total Price for each line is txt_TotalPrice. I want to have a Grand Total in the report footer. I placed a text box in the footer with the following expression: =sum([txt_TotalPrice]). When I run the report Access prompts me for the parameter value of txt_TotalPrice. I've been trying to solve this for quite a while now - but I'm totally baffled.
I have a report and I am trying to Round Up the calculated field SumOfAccrual Amount to 2 decimal places. I am attaching a screenshot of my report and output.
I'm working with a report that totals the number of times a topic is returned from a query. If a topic is not returned at all, i don't want it to show at all. Currently it is showing a blank field for that topic name and blanks in the count as well. Here's the filter i've put in to pull the right data out of my query: =Sum(IIf([Caller Used Resources]="No",1,0))
I have a table of timecards each recording minutes spent on each task for each client and I have summed those minutes by client in a query.I have then in the same query converted each sum of minutes to hrs:mins format using this calculated field:
HrsMins: [SumOfMinTime]60 & Format([SumOfMinTime] Mod 60,":00")
So this turns e.g. 261 minutes into 4:21..Based on that query I have a report showing total hrs:mins spent on each client, e.g.
Smith 4:21 Jones 5:32 James 1:23
Now I want to show a total at the bottom, i.e. in the above example it would be 11:16.So for the control source for a total field on the report I tried:
=Sum([HrsMins])
But when I do that I get an error message: "Data type mismatch in critieria expression"I may be because I am trying to sum calculated fields amounts that are calculated using a function.Or it may be that the format is not being recognised as hours and minutes and thus cannot be added up.way in which I could get a total here in hours and minutes format (hrs:mins).
Basically i have a form where i get info from multiple tables. On the main form itself i have 3 calculated fields for hours where i add all the hours i choose (from a subform) onto the main form.
My issue is i can create a query to come up with all the fields for my report, but how do i get the calculated fields on my main form on the report? Is there a way to print the calculated fields on the main form to a report? or do i have to do the same calculations on the report itself?
I have been trying to figure out why my subreport is only showing sales price for only one of the records on my subform. Everything else works as it should, but it only displays the sales price for the record which is active on the subform.Attached is the database with the subreport called rptProposalItems with the field 'Sales Price' which is experiencing the issue.
I have a form which works good enough. In this form, there is a text box that counts and calculates records from a subform. The name of this text box is "text1" ...
I'm creating a report to check for over- or under-stocked items. The report is working fine, gets all the records etc. except that it thinks that the OnHand field from my inventory query is text or something, at any rate not a number. I have successfully set the format of the field in the query to General Number, but that doesn't seem to have worked. Here's the SQL for the report:
Code: SELECT DISTINCT Signs.SignCode, Signs.SignDescr, Size2.XYdim, qryOnHand.OnHand, Bins.Rack, Bins.Level, Bins.BinNum FROM (Size2 INNER JOIN (Signs INNER JOIN (Items INNER JOIN qryOnHand ON Items.[ItemsID] = qryOnHand.[ItemsID]) ON Signs.[SignID] = Items.[SignID]) ON Size2.[SizeID] = Items.[SizeID]) INNER JOIN (Bins INNER JOIN InventoryDetail ON Bins.[BinID] = InventoryDetail.[BinID]) ON Items.[ItemsID] = InventoryDetail.[ItemsID] WHERE (((qryOnHand.OnHand)<=[Check for signs with fewer than:]));
I have a field that sums pounds. I need to convert this to tons (rounded to the nearest 3 decimals), then multiplied by $67.50. This will calculate a fee payment.
This is what I have now:
Code: =Round(Sum([Hazardous_Waste]/2000*67.5),3)
The total pounds is 2675.
After dividing by 2000, Access generates a number of 1.3375. It rounds 1.3375 to 1.337 which generates an incorrect final total. Not sure how to alter this to round properly.
The calculation works fine; however, I only want to show the whole number (not rounded up; not rounded down). In other words, if the result is 0.9967, then I want 0 to appear.
I cannot figure out how to make this happen. In the properties section I ensured the format was "general number" with 0 decimal places but this didn't change the result. I tried changing the format in the calculated field, again, I wasn't successful.
I have a report that I would like to have the rows be a specific color based on the value in 1 field on the row.
I have attempted to use conditional formatting but it will not work (IE, I can get font color to change, but not field boxes to have color).
The field is labeled [text144] based on the value in the field (1,2, or 3) I would like the field to be a different color. i.e. 3 = green 2 = yellow 1 = red
I would like to append a text item to each value in a calculated field. consider the field name is "Division" and I want to append the word "Division" to the values put out by the field "Division"
My attempt was: Division & " " & "Division". This produced an error in the report.
How do you change negative number to red in a report's text box? i am thinking it is an iff statement in the control source field but running into issues.
Is there a way to change all Negative nubmers to red in a Report? That is, do i have to change all text boxes individually?
I've now since moved everything into one table but i need formatting of my calculated field (I'm new to all this).
Below are the 3 expressions working independently of one another, I just need them combined in to one if possible. As I am getting an "invalid syntax" error or "too many arguments" when I try to get it working
PHP Code:
0.5*IIf([Type]="Offlist" And [APP_LINE_OFFA]>3,1,0)+0.2*IIf([Type]="Offlist" And [APP_LINE_OFFB]>2,1,0)+ IIf([Type]="Offlist",Abs([EP_DETAILS_OFF]*0.15+[REF_DETAILS_OFF]*0.15),0)
In my form I have a calculated field that works out the time elapsed for a job, worked out as the QTY/RUN RATE which gives me the time in hours. However I couldn't format the box as a date/time, as it is a calculation and the times may go over 24 Hours which results in the date/time giving me something like 31/12/1899 16:00 for example.
I've got around this now and I've formatted the results as HH:NN:SS using a public function in a module, but the problem is this is now stored as a text field. I've tried setting this to a number field but the formatting doesn't carry over. I've tried setting a custom format in the table as HH:NN:SS but then all I get is just a bunch of 0's, no calculation results.
So how to format this as a number field properly?
Also for any extra information:
- I know you're not supposed to store calculated results, but this is slightly different, the calculated field is a standalone text box and the bound field is a formatted text box. - The reason I have to store the calculated results is because my boss wants to eventually see a chart of the total hours of jobs each day, hence why I'm asking if this can be done as a number field.
I need to create a query in Microsoft Access to enter 1 or 0 in a field based on whether numbers in another field is positive or negative. Here are the details.
1 entered in a "late" field if "TotalHoursAheadOrBehindScedule" field has a positive number 0 entered in a "late" field if "TotalHoursAheadOrBehindScedule" field has a negative number
In my tables i have used calculated fields. one of the fields is to "total expenses." In a report, i need to show the sum of all the "total expenses", the filed populates in the report but the cents are missing. for example if the amount is 6080.40 it shows as 6080. how can i get around this? I have tried changing the decimal point value to 2 at which point the value turns to 6080.00 when it should be 6080.40 (i am a beginner at this i am assuming the answer will probably involve c++ or visual basic's, two concepts i am not familiar with.)