MS Access, number formatting - ms-access

I need to display a number (real), ie 1234.567 like "1.234,56" or "1,234.56". I know that I have to use Format() but I can't figure it out. (It's for a textbox where the 'Control Source' property is set to some number field)

This should do it:
Format(number, "#,##0.00")
Where the actual separators used depend on the current locale setting.

Below method worked for me in ms access 2000-2003.
You should make changed in Table and in reports.
Table.
Go to the required field, Change data type to Nnmber, Field size to Decimal, Format to Standard.
Report.
Select the control where you want the thousand separator, select properties the format Select standard,, Decimal places 2.

Related

Format a column with percentage using VBA

I am exporting a report to Excel from Access through VBA. There is a column in the report that should be formatted as percentage and round. How can I format this?
Set the Format property of the textbox in the report to: Percent
You may have to divide the value by 100 first. If so, rename the textbox to anything else than the name of the field, and use this expression as ControlSource:
=[YourFieldName]/100
For a new formatted string value, use Format:
=Format([YourFieldName],"Percent")
You don't mention what kind of rounding you need, but functions for all general methods of rounding are listed here: Rounding values up, down, by 4/5, or to significant figures

Format Numbers in Multiple columns of SSRS Report

Currently I am working on a ssrs report. The table in report is having about 30 columns. For each column I have to modify the number format (to either 2 decimal or no decimal numbers). I can do it by click on every column and modify the number property in format menu. But is there any way to format all the columns at a time?
I tried to select entire row -> F4 -> properties -> Number -> Format-> Expression. And set expression to:
=FormatNumber(Fields!HoursWorked.Value&Fields!ContactAttempted.Value&Fields!UnableToContact.Value,2)
But it throws an error
Type character '&' does not match declared data type 'Object'.
Can any one help me on this?
This is really, really stupid; you have to have spaces before and after the ampersand, and if you don't then you tend to get that error message. I don't know why, it's daft as hell but I bet that's it. Catches me out constantly. Try:
=FormatNumber(Fields!HoursWorked.Value & Fields!ContactAttempted.Value & Fields!UnableToContact.Value,2)
If you want to set the Format property of a cell (or cells - note you CAN set the format for multiple cells at the same time) then you need to specify a value or expression that resolves to a recognised format string, e.g. '$'0,.00;'$'-0,.00 or C2.
The expression you have given returns the actual formatted value of the cell, so this will not work if entered into the Format property - this needs to go in the Value property of the textbox.
You need to set format number for each column separately. If you don't want to set number format in Text Box Properties, you can set format such way:
Click on cell with value -> F4 -> field Format in Properties -> set format (for example, you can use this format: #,0.00 for numbers with space as 1000 separator and negative numbers as -12 345.00)

Microsoft Access formatting: Need format to display either Date or "0". 0 keeps displaying as 12:00:00AM, how to fix?

I need to make it so that the one field either displays the Date or the value of 0. They're two separate formats, and so I can't get Access to mix the two up. Logic functions keep displaying errors for me.
You can do conditional formatting like so as a "custom" format:
[=0] 0; [>0] mm/dd/yyyy;
[=0] checks if the value is zero, if so, the cell is set to 0. If it is greater than 0, use mm/dd/yyyy or whatever date format you like.
You can use Format. Rename your textbox to be different from the date field name and this as ControlSource:
=Format([YourDateField],IIf([YourDateField]=0,"0","yyyy-mm-dd"))

Access Report Show # instead of Date

My access report is showing ##### instead of showing the datetime value in the row. When I clicks on it the ##### turn outs to the actual date as if it was hidden behind it. I have tried changing the date format to Long Date Medium Date and Short Date in both the related table as well as in the report's Format properties but is it not working at all.
Why is it so?
The problem you have can be because there's no enough space in the textbox (or other control) to display the value you need.
You can solve this by either increasing the size of the control or decreasing the size of the font you are using.
An alternative can be to convert the value you want to display into a string. Since you are dealing with dates, I sugest you use the format$() function. For example:
=format$([yourDateField],'yyyy-mm-dd')
will return a date in the year-month-day format. Check the online help to know more about this function.
Hope this helps you

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.