View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Problem with numeric blank fields

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?



"Iaacov Rosenberg" wrote in message
...
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