My formatting won't work !

G

Gdw Vaganee

I have Excel 2002 on WinNT4sp6. The installed language is Dutch in Belgium,
so the value notation is a stop . to separate the thousands, a comma for the
decimal and the euro sign.

In a word template I have a REF field using a format as follows

/# ".#0,00" but instead of showing 1.1 when that is entered (in respect to
an ASK field) it keeps rounding up to 2.0.

help please? What have I done wrong. with the normal English value notation
on an english language PC it works fine, but when I switch to the dutch
(Belgian) notation it doesn't work properly ?

thanks for any help ... Roger
 
P

Peter Jamieson

Does it work if you enter 1,1 in the ASK field?

(Here I have tried this on an English language Word 2003 using one of the
Belgian locales and a mask of ".#,00 <euro symbol>". If I enter 1.1 in the
ASK, or just using { SET mynumber 1.1 } I get 2,00. If I enter 1,1 or { SET
mynumber 1,1 }, I get 1,1 <euro symbol> . So that does not match your
situation exactly but it's close).
 
G

Gdw Vaganee

Peter .. thanks for your help. I have changed the mask to what you suggested
and played around with it some more. The mask is in the REF field, and the
data is always input via the ASK field.

The problem seems to be the decimal point on the numeric keypad. When I
enter data in the form 9,9 using the comma from the keypad, it is fine ...
the figures come out apropos the mask, ie 9.90 (or in dutch notation 9,90).
however when I use the keypad it seems to read the decimal point as a full
stop and therefore rounds up, so 9,9 would come out as 10,0 and ignore the
format mask.

We use the numeric keypad decimal point for other software with no problems,
but it seems that the code for the numeric pad decimal point must be read
differently to the keypad comma ? Any ideas ?

thanks .. Roger
 
P

Peter Jamieson

OK, if your keypads have full stop and comma I can't easily test or suggest
from here. I suppose the only simple thing I would want to test is that
setting the language in the language bar didn't make any difference, but I
doubt if it will.

But if Word is receiving a "." when it needs a ",", the only suggestions I
can make are that you either move to using a VBA Userform or inputbox to
capture the data and transform it, or transform the "." into a "," inside
Word, or format your REF fields using a different technique. The only way I
can think of to do this using fields would be to use a DATABASE field which
may be overkill.

But if you want to try that, a way that should work in both Word 2000 and
later (though 2003 may create difficulties because of its pop-up messages
about SQL) would be the following:

Create a folder (say c:\d ) and an Access .mdb file in it (say d.mdb) with a
table in it (say "t") with a single text field "f" and a single row with "r"
in it. Let's suppose the bookmark your ASK field creates is called "X"

Insert the following nested field code and verify that it works:

{ DATABASE
\d "c:\\\d\\d.mdb"
\c "DSN=MS Access Database;DBQ=c:\\d\\d.mdb;"
\s "SELECT format('{ X }','#.,00 <euro symbol>') FROM `t`" }

There are a number of things to notice about this:
a. the { X } is a Word field, i.e. with the special field braces.
b. the single quotes around "t" in FROM `t` are backwards single quotes,
whereas the other ones are vertical single quotes '
c. the DSN name needs to match the one on your system, which may not use
the English name.
d. there is no \h - having only one column, one row, and no headers in the
result means Word inserts the result without wrapping it up in a table
e. you may to format the "D" of "DATABASE" with the format you need and add
a \*Charformat at the end
f. it seems to work with numbers containing either a . or a , but I suspect
inserting thousands separatos in the ASK field will cause problems.
g. "format" is quite versatile but is different in a number of ways from
the Word field equivalent. The position of the "." is important. Also, if
you want to use the full numeric format facilities (where you can have
formats 'a;b;c;d' for positive, negative, null and zero values) you will
probably need

"SELECT format(cdbl('{ X }'),'#.,00 <euro symbol>') FROM `t`"

h.You may need even more if you want to deal with invalid numbers, but I
leave that up to you.

I've checked this particular version in Word 2003 but not Word 2000 or Word
2002. In Word 2000 it used to be slightly simpler but I wasn't able to make
the old technique work in 2002/2003.
 
R

Roger Ottaway

Peter

thanks. A couple of years ago I had a similar problem with the number 2 on
the numeric keypad giving a different response to the number 2 on the alpha
keypad, they are the same .. but they have different "codes". Perhaps this
is the problem with the decimal point on the numeric keypad versus the comma
on the alpha keypad when using the belgian value notation and dutch version
of WORD. Do you know of any literature on this ?

thanks

Roger
 
P

Peter Jamieson

Well, the following seems related but is very specific (Windows NT SP2 or
earlier)

http://support.microsoft.com/default.aspx?scid=kb;en-us;166151

The following article appears to document the fix:

http://support.microsoft.com/default.aspx?scid=kb;en-us;186634

However, my experience here is that numeric keypad "." results in "." in
Word and Notepad on Win2K and WinXPPro even when my regional options specify
a Belgian (Dutch) keyboard layout, but in "," in Excel. So I have to assume
that individual applications are handling this keystroke in different ways.
 
R

Roger Ottaway

Peter

yes .. it seems to be something that is unique to the Belgian numeric keypad
decimal point/comma and dutch version of WORD, and using code interfacing
with those. The articles you indicate don't give a fix for my particular
problem, but I will search the knowledge base. thanks for your help

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top