Mail merge displaying wrong numeric data - ms-access

I am using Office 2003
On Access, I export values from a form into a .xls, after that using mail merge on word I import the data to be displayed on the file. Data such as dates and strings are displayed correctly.
In Access theres the value 9,916.12 wich is exported to the .xls as 'price' that contains 9,916.12, both values match keeping the same format, but when mail merge kicks in the value displayed on the document becomes 9916,1200000000008.
I am lost as to what is causing that. The field that is being exported contains only 2 decimals, it displays on excel as a value with only 2 decimals yet when word reads it, it adds random decimals to it. If I manually alter the value on excel the error persists, so does it if I choose a different record to be exported.
Any tips on how to solve the problem?

See this Microsoft Answers discussion and this in-depth description on how to use a merge field such as {Mergefield NumberFieldName \# ",0.00"} to work around the issue. It's been awhile since I had to do mail merges, especially with Word 2003, but I think that should do it.

Related

Formatting of exported SSRS report to CSV file

My 2008R2 SSRS report contains a detail column called debit which is formatted like "#,0.00". When I export the file via .csv the debit column does not always have the right formatting of 0.00. If the number is 0, then what appears is "0". If the number is 123.40, then it appears as 123.4. If the number is 123.44, then it appears as 1213.44.
I want each number in this column to always have 2 decimal places in the .csv file. I checked out many other articles on stackoverflow about this, but none seem to address this issue correctly.
I tried changing the format to many other formats. I noticed when I changed the format in SSRS to "C" for currency, then the 2 decimal places appeared. But the problem with that is my users do not want the "$" symbol.
I tried changing the CSV export to ASCII format in the config file, but that did not work.
I used the code here:Non-Unicode CSV Export from SQL Server Report Server
Can anyone help me with getting the format correct in the CSV file without mannually changing the CSV file?
Thank you!
The problem mentioned is report header's are being displayed when user generate report for CSV format, which is not supposed to be like that. But actually in CSV Format, While in the preview , we can hide or show report header's and it doesn't show textbox names .
While in the exported/generated one , the CSV format hides the report's headers, but instead of that it shows textbox names and any changes We made in the properties to change that textbox name to make it as blank or disappear, it reflects on that column values but doesn't on that textbox name.
So I want to mention that better We can give some other meaningful names or by default it shows as 'Textbox1', but we must give any valid name to that textbox name and it appears on the generated CSV format.
NOTE: I also want to mention that all visibility properties works well with the report header's but not on the textbox names.

Have SSIS detect the column sizes of a csv file

I'm trying to import a csv file into SQL using SSIS and am hitting a fundamental flaw.
SSIS seems to determine that all fields are varchar(50), even though it correctly identifies the comma delimiter.
This is causing issues when I try to send the data to my table in SQL.
Is there a way of making it recognise that a field of length 3 is actually a field of length 3, and not 50?
Thanks
Yes, there's a Suggest Types function in the Flat File Connection Manager Editor.
Assume you have got a CSV file shown in the first image.
Create a new Flat file connection, and browse this file on your computer. The Columns tab shows the sample of the file.
Click Advanced tab. There you can see all columns have DT_STR type with the length of 50. What you can see is the Suggest Types... button. Click this.
Set parameters as you like. Defaults are all right in my case. Click OK.
Now the first column has the type of DT_STR with the length of 1. (The other two columns have got new types as well. The Number column got DT_I1 (because we choosed the smallest appropriate integer type option), and the Date column got DT_DATE.

ssrs csv export numeric values

I'm using SSRS to build a report that can be exported to multiple types (PDF, XLS, CSV...)
The report consists in a table and some columns have numeric values such as latitudes or longitudes, something like -1,234567
When exported to csv and opened in excel, these numeric values loose the ','
Is it possible to make this values as text in report builder so it's kept as it is, with no formating changes on the csv file?
tks
An easy way to do this is to use a Format expression instead of accessing your report field directly.
e.g.
=Format(Fields!OrderPrice.Value, "#,###.00")
instead of..
=Fields!OrderPrice.Value
This will coerce the numeric value into a string. The number format will ensure you keep the comma. When exported via CSV, the value will be wrapped in quotes, meaning your formatting comma won't trip a parser up.
Massive caveat
This solution is not perfect. The problem is that although you get the desired result in your CSV file, any SSRS Excel export you produce will flag that field as textual content, meaning that your users will have to tell Excel different every time they open that report.
Similarly, if someone opens your CSV file in Excel, the same thing will happen. Excel isn't smart enough to recognise that the thing in quotes is actually a number, and it'll again, treat the column as textual.
The reality is that CSV is a limited format. It's primary concern is content - it doesn't convey formatting information, and even if it were possible to give SSRS more "guidance" on individual export routines, the inherent limitations of the CSV file format mean that some sort of compromise ( or extra work on the Excel end ) has to be made.

MS Access setting to ignore date conversion error

An Access DB imports a fixed width text file; one column is mostly dates.
When the date is not available, the file's creator actually uses the string "Null"
Access puts the row in the table with that field actually null.
But, when the files started coming with different field widths, I copied the DB, tweaked the starting/width values in the input spec, and imported. NOW, all the rows with null get logging in (table)_import_errors as an error converting text to date.
I have found no setting (not that I changed any) to explain it. One difference is that although both DBs are in Access 2000 format, the original is on a machine that still has Access 2000, while the new one is being handled by Access 2003.
Is that a behavior change in the Access version? Is pre-processing the file the only solution?
Thanks, David. That's what I would have done (except for the Excel part) if it had not fixed itself. I posted that, but apparently someone didn't like the public admission that Access has bugs.
The only thing that changed was that two other columns in the fixed width plain text input was wider. Yet Access "decided" to discard the whole row instead of just the date field for three consecutive attempts. The fourth time, it still reported it as an error but imported the rest of the row.
So, when Access misbehaves for no good reason, try again a time or two, then try explicitly coding the conversion from text.
Two possibilities:
Use a buffer field or buffer table that imports the date field into a text field. Then you can process that into the appropriate values in the final destination field.
Use a SQL import instead of DoCmd.TransferText. What you do in that case is use a connect string in the FROM clause so you can then process the date field in your SELECT:
SELECT Sheet1.FirstField, Replace(Sheet2.DateField, "NULL", Null) As DateField
FROM Sheet1 IN 'C:\Import\Spreadsheet.xls'[Excel 5.0;HDR=YES;IMEX=1;];
Convert that into an INSERT query and you're golden.

SSRS 2008 date formatting and exporting to excel confusion

Suppose I have a field with a date value in a Reporting Services template, e.g. =CDate("2010.12.03"), I apply the "d" format to this cell, which, according to the description, "will reflect the regional settings of the report". I generate the report using the English language, the date is displayed as 12/03/2010, which is fine. Now when I export this report to excel, I have no idea what the __ happens.
First scenario: the regional settings of the computer are set to English (United States). When I open the excel document, the value seen in the cell is 12/03/2010, as expected. When I click on it, I can see that the actual value stored in the cell is 2010.12.03, which also seems reasonable - some formatting is applied to the cell, it's not simply exported as text. But when I try to figure out what type of formatting is applied, by right clicking and checking Format Cells, I see that the format is "General", i.e. none! How can this be ? This is Excel 2010 by the way, but the file itself is .xls, of course.
Second scenario, where it gets more interesting: now the region of the computer is set to e.g. Lithuania, where the date format is 2010.12.03. I open the same document and see 12.03.2010. Now that simply does not make any sense. Exporting many times I've encountered that sometimes the cell is formatted as [$-10409]m.d.yyyy in excel (under the Custom section). What is this, what does the 10409 mean ? The weirdest part of all: if I close the document without saving, change the computer region back to English (United States), reopen the document, the format is now [$-10409]m/d/yyyy ! HOW is this possible !??
Basically the same thing happens with numbers and with thousand/decimal separators - excel uses the region of the computer to format these, but the actual format of the cell can be something like [$-10409]#,##0.00;-#,##0.00 or General - again, depending on the region of the computer, direction of wind and the temperature outside.
My question is then, first of all, what the __ is going on ? Second, how should the excel document behave according to the specs, i.e. what does the statement that a format "will reflect the regional settings of the report" in the BIDS designed, where I chose the "d" format for the date textbox, mean ? Does it mean, that the format will be determined by the language of the report and the result will look the same on all computers in the world (which makes sense, since this is how other formats behave, i.e. if you export the date to a pdf, it stays the same always) ? If not, which appears to be partially the case in excel, why doesn't the exported date cell have the regional date format, i.e. the one that you normally use in excel, the one which formats the date according to the region of the computer ?
Are these some kind of limitations of excel or what ? Why can't we have consistent behavior, i.e. either make everything sensitive to the culture of the computer viewing the document or don't, why is the actual behavior somewhere in between ?
Excel uses a custom encoding for the date, and uses the machine regional settings as a hint on how to format the contents. The encoding is archaic, and has lots of specific, historic gotchas.
This means that the kinds of bugs that you see often do happen - you'll have data that's been exported to Excel, which then has its formatting and contents mangled once opened for the first time by the actual Excel application. The problem can be anywhere along the line - maybe the library that exports the data to Excel doesn't deal with some of the more esoteric historic cases well, or maybe Excel is confusing itself along the way.
I've had some success in the past with exporting dates as a strings to a CSV file, stripped of formatting, and then importing them into Excel/opening them with Excel.
I sorted my date formatting problem by:
adding calculated fields for the dates :
=IIF(IsNothing(Fields!Date_Delivery_Confirmed.Value),nothing,DateSerial(DatePart("yyyy",Fields!Date_Delivery_Confirmed.Value), DatePart("m",Fields!Date_Delivery_Confirmed.Value),DatePart("d",Fields!Date_Delivery_Confirmed.Value)))
set cell Textbox as dateformat
how I am using *dateformats (localised) I checked my server laptop and report are set to the right language
I have aligned elements vertically in the report so it ( the visual gaps) doesn't create extra empty columns when exporting to excel. Because 2 excel columns merged to 1 date-cell will never get any format but "General format"