How to calculate totals on a memo Field in MS Access 2010? - ms-access

I have imported data from MS Access (mdt) file to MS SQL. Now I would like to test that the long text was not truncated during the import. I calculated minimum, average, maximum and sum of lengths of texts in the resulting data, like this
SELECT
MIN(DATALENGTH([LongField]))
,AVG(DATALENGTH([LongField]))
,MAX(DATALENGTH([LongField]))
,SUM(DATALENGTH([LongField]))
FROM TheExportedTable
Results:
0 725 7574 2156708
I would like to check in MS Access that the original statistics on this field was the same. The type of the field in MS Access is memo. How can I do it? I tried adding a calculated field, it just did not work. When I tried adding a calculated field, nothing happened...

In Access you would use LEN instead of DATALENGTH:
SELECT
MIN(LEN([LongField]))
,AVG(LEN([LongField]))
,MAX(LEN([LongField]))
,SUM(LEN([LongField]))
FROM TheExportedTable

Related

MS Access and number of decimal places returned in calculations

This is not a formatting question.
I have recently found that doing a simple division in an MS Access (2010) query does not return the expected number of digits. Even the simplest:
(3.1 + 3.1)/2 = 3.1
But MS Access returns 3.09999990463257
Yes, I can round and/or format the result to show a specified number of decimal places. Also, in the example above, rounding would give me the true value of 3.1; however, my question is simply "why does MS Access do this?" rather than how to fix it.
Both
SELECT (3.1+3.1)/2 AS Result FROM tblFoo
in a query, and
Debug.Print (3.1 + 3.1)/2
in VBA return 3.1 for me.
Are you summing up values of data type Single? They have limited precision.

How can I get an expression to return a floating-point number?

Here is the data I am working with. It was imported from Excel and Double was the data-type as shown below:
|Store| Multi | Total |
+-----+------------+-------------+
|5971 |1643.5765892|2168.17562315|
|5977 |821.7882946 |1151.7620749 |
|5975 |1307.5744786|1787.7159673 |
I put this table in an expression and divided Multi into Total but the query when run does not show the floating-point number (percentage). I have tried putting conversion functions around the parts of the expression and running it but it just won't return a floating-point number. Is there anything that I can do?
Here is the expression:
Expr1: [Multi]/[Total]
Microsoft Access 2013 currently returns zeroes.
When I copy and paste the data into excel and re-import the data into Microsoft Access 2013 the problem is solved. So instead of a MS Access problem I think I am dealing with a data import issue.

MS Access when linking I get an strange field number

When linking CSV files to MS Access 2007 I get some fields with #NUM!
Why do I get this?
I was thinking that it is probably because I have fields with the following numbers 9999999999 and the data type i use is _long Integer_, but how can I get the actual number?
Is it probably because I have fields with the following numbers 9999999999 the data type i use is long Integer
Yes. The largest positive value that will fit in a Long Integer column is
2,147,483,647
so
9,999,999,999
won't fit. You will either need to change the column type to
Field size: Decimal
Precision: 10
Scale: 0
or store the values as Text.

MS Access Convert text to shortdate

Hi all i have a question,
I have a field in the table whereby its a text field and i want to convert it to date field. Though all the values within are in date format however its not convenient to change because of some circumstances.
Thus i need to change the text field to date field so as to do a comparison or validation.
Im using MS access SQL for this project so please help me
I have tried
TRANSFORM Count(Registrants.[Field1]) AS CountOfField1
SELECT Registrants.[Country] , Count(Registrants.[Field1]) AS [Total Of Field1]
FROM Registrants
WHERE Cast(Registrants.Field1 As Date) Between #15/6/2014# AND # 30/8/2014#
GROUP BY Registrants.[Country]
PIVOT Format([Field1]);
Cast does not exist in MS Access sql.
Use DateValue instead :
WHERE DateValue(Registrants.Field1) Between #15/6/2014# AND #30/8/2014#
See here for sample usage and syntax.
Also I noted a space in your 2nd date, I assume that's a typo.

MS Access, number formatting

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.