how to get an integer from the current year in Microsoft access - ms-access

I want to get the current year and minus it from another year and have the result be an integer.
To do this, do I have to use a calculated column and what code would I have to use.
I have tried things such as Date() however it always tells me that I cannot use it in a calculated column.
Thanks

That could be this expression in a query:
YearDiff: [OtherYear]-Year(Date())

Related

date field criteria in access to have equal years

I rarely use access but I need to update a query. How do I make it so a SERVICE DATE year and ADMIT DATE year equal each other?
Date fields currently show date like this: 20201015
Find year of Service: DOSYEAR: Left([svcdat],4)
Find year of Admit: DOAYEAR: Left([admdat],4)
I tried to create an additional column where the service and admit year equal each other like below and put "test" in the Field name. When I try to run though a parameter pop up appears. What do I need to change?
Left([svcdat],4) = Left([admdat],4)
Thanks.
Move your expression to the top row, and replace it (in the criteria row) with True.

How to use DateDiff in calculated field in access

I am trying to get "No of days late" in a particular table in MS access. I am trying to use calculated data type.
I have [ActualReturnDate] and [ReturnDate] in the same table (both are Date/Time) and I want to save difference between two columns in a calculated field.
I am using following expression:
DateDiff("d", [ActualReturnDate] , [ReturnDate] )
But no matter what i do I get error saying "The expression X cannot be used in a calculated column."
So does that mean I cannot use DateDiff in Calculated field? If not how should I do it?
You indeed can't do this in a calculated field.
Use a query instead, add a column and do the calculation in that column.
You can just add and substract dates.
Just use [ActualReturnDate] - [ReturnDate] as the expression to calculate the difference. If both fields are defined as date/time, the result should be the same, only include the time part as decimal.
If you want only whole days, you can wrap the result in Int()

Access query using calculation

I'm trying to make a query using a calculation with Date().
I have a field named [Currentordue] and a field named [duedate]. What I'm trying to accomplish is making a query to limit the results by "if [currentordue] equals "due" or if [duedate] minus today's date is less than 30 days."
I've tried a few different ways but always seem to end with either an error or with no results showing (which would be an error as well since I know there are fields that are due).
Any and all help would be appreciated.
Here is a way to use two different date conditions:
SELECT Table1.Currentordue, Table1.duedate, DateDiff("d",[duedate],Date()) AS Expr1
FROM Table1
WHERE (((DateDiff("d",[duedate],Date()))<30)) OR (((Table1.Currentordue)=[duedate]));

How to calculate % in table

I am trying to find-out % in the column level which should 4121/7975-52% similar to other also but somehow it is not working & showing 13%. Kindly help me out.
You will need to use a scope in the expression you are using to calculate the percentage. Month, in the example below, is the scope.
=Fields!qty.Value/Sum(Fields!qty.Value, "Month")
Since I don't have your RDL, you will need to determine what the scope name should be based on the group name for the months (Jan, Feb. etc.). This can get a little tricky, so you may have to try a few different scopes to get what you need. Chances are it will be whatever the name of the field is you are using for the month values. The group properties for that column will show the name, too.

Use a summary field in an expression in SSRS reports

I have the details of my report being summed up in a summary expression, all works fine. The fields are decimal values of hours worked. Thus, the summary value is also a decimal value. I'd like to access the summary value and convert it to hours / minutes. I've labeled the express as "WorkTimeSum", but can't seem to get a handle to it, however. Fields! obviously won't work since it is a summary expression. I was thinking ReportItems! should work, but to no avail. How can I use this expression field (in a summary row) in an expression in the same summary row?
If I've understood correctly, you're asking how to reference the textbox containing the total work hours value so that you can convert it to hours and minutes using an expression in a different textbox?
You can use either ReportItems! e.g.
=ReportItems!Textbox20.Value)
or ReportItems("") e.g.
=ReportItems("Textbox20").Value
to reference the value of another textbox. Be careful with the names as they are case sensitive.
You can use aggregate functions in any expression. For example, in any header rows you can use the following expression to determine the total hours value:
=Floor(Sum(Fields!hours.Value))
Sum(Fields!hours.Value) is just the total hours in whatever context, e.g. the group total if it's a group header row; you can use this expression as an input in any other expression you require.
It sounds like your issue wasn't the conversion itself, so hopefully this points you in the right direction. If you need further information please specify.