Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / May 2006

Tip: Looking for answers? Try searching our database.

Problem with numeric blank fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Iaacov Rosenberg - 24 May 2006 13:33 GMT
Hi,

I noticed a flaw in Word Mail Merge using MSQuery.

If a numeric field is blank (i.e. null value in DB), Word duplicates the
previous record value for that field. This doesn't happen with strings or
dates.

Conditional formatting is not an option because the field already has the
wrong (=previous) value.

I could go back to the DB and generate a view which places special values
instead of nulls so I could have tested for it in Word. This can't be
implemented as a generic solution (each field might require a different
special value) and is highly undesirable.

Does anybody know about a better workaround?

Thanks,
Iaacov
Peter Jamieson - 25 May 2006 00:11 GMT
I have come across this, or something similar, before (in fact I think there
is a Knowledgebase article about it, but I just looked and could not find
it). I thought it had been fixed, so...

The very simple test I just set up did not reveal the problem, so it would
help if you could be more specific, i.e.
- which version of Word/office?
- which type of database? (and are you seeing the problem with several
types of database)
- is this with a particular type of numeric data (e.g. a "currency" field)
or all types?

In this case, until I can replicate the problem I can't test possible
solutions. Unless there is an update that fixes the problem, the only thing
I can think off is to modify the SQL directly in MS Query (i.e. rather than
create a View in the database), or in a VBA OpenDataSource call, to do
something along the lines of:

SELECT ... iif(isnull(myfield),0.0,myfield) AS `myfieldx`,...

However, problems with that approach include:
a. the code may need to be more complex to cope with all possible types of
empty field
b. it may not work if if myfield evaluates to the value in the previous
record before the isnull function is evaluated.
c. you may not want a "0.0" result in that case. but you could at least
create a new field saying whether the original field was null or not
d. the precise code depends on the dialect of SQL (i.e. is not generic -
unless you can use ODBC escapes in this case - Id have to check)
e. the code would have to be manually created for each data source.
f. The code for each number is fairly long, and if the data source has a
lot of columns the SQL query text may easily break Word's length limit
(either 255 or 511 characters)

Best I can do for now.

Peter jamieson
Also, you may not
Can you be more specific:
version of Word/office?

> Hi,
>
[quoted text clipped - 16 lines]
> Thanks,
> Iaacov
Iaacov Rosenberg - 25 May 2006 04:28 GMT
I found the problem in Word XP, either the original version or SP3. Didn't
check other versions.

Thanks to your questions I went for a little research...
Here are my findings:

I tested with 2 databases: Oracle 8i and ASA 8.03.

Oracle has 2 numeric types: NUMBER and FLOAT.
The Oracle test worked fine. I tested with NUMBER(3), NUMBER(5,2) and
FLOAT(5).

ASA has several integer types, 3 floating point types (FLOAT, DOUBLE, REAL)
and 2 exact decimal types (DECIMAL and NUMERIC).
In the ASA test, only NUMERIC failed.

I checked the ODBC log to find out what ODBC types they were bound to.
DECIMAL was bound to the SQL_DECIMAL ODBC datatype and NUMERIC to
SQL_NUMERIC. According to ODBC reference both types differ only in their
precision handling.
Not surprisingly, the Oracle ODBC driver converts NUMBER to SQL_DECIMAL.

I also verified that inside MSQuery, all types behave correctly.

The solution I can see is to cast all NUMERIC to DECIMAL in MSQuery, but I'm
still left with some of the problems you mentioned (d, e and f).

Any better idea?

Thanks,
Iaacov

"Peter Jamieson" <pjj@KillmapSpjjnet.demon.co.uk> ëúá
áäåãòä:emBGNe4fGHA.4080@TK2MSFTNGP03.phx.gbl...
>I have come across this, or something similar, before (in fact I think
>there is a Knowledgebase article about it, but I just looked and could not
[quoted text clipped - 57 lines]
>> Thanks,
>> Iaacov
Peter Jamieson - 25 May 2006 10:20 GMT
> Any better idea?

No, sorry.

Assuming there are two possible problems:
a. the ASA ODBC driver is not returning the data correctly
b. MS Query/Word are not dealing with SQL_NUMERIC data correctly

I suppose I would have to try to seek a solution from ASA for (a) and from
Microsoft directly for (b) (I don't work for them - you would need to
contact their support function or Customer services directly).

What I do know is that there are, or have been, problems with Currency data
in Access and Excel in the past. Those problems could well be related to the
one you are seeing. When I looked at the problem several years ago, my best
guess was that there might be an an error somewhere in a numeric routine
used in more than one place in MS software. It really was nothing more than
a guess, but perhaps someone in Microsoft knows more about it.

Peter Jamieson

>I found the problem in Word XP, either the original version or SP3. Didn't
>check other versions.
[quoted text clipped - 91 lines]
>>> Thanks,
>>> Iaacov
Iaacov Rosenberg - 25 May 2006 11:43 GMT
Tanks a lot.
Iaacov

"Peter Jamieson" <pjj@KillmapSpjjnet.demon.co.uk> ëúá
áäåãòä:uSX1px9fGHA.1260@TK2MSFTNGP05.phx.gbl...
>> Any better idea?
>
[quoted text clipped - 16 lines]
>
> Peter Jamieson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.