It's a little hard to say without seeing the values you're comparing,
but I'll guess that it's saying something equivalent to 11 < 2. The
problem is that even though the field formats are defined as "number",
the values themselves are strings -- they're strings that must contain
only digits, periods, and commas, but still strings. Therefore VBA is
comparing them as strings, not numbers.
You need to compare the number equivalents of the strings to get a
reliable result. Do something like this:
Dim numF5 As Single, numM5 As Single
numF5 = CSng(ActiveDocument.FormFields("tbxF5").Result)
numM5 = CSng(ActiveDocument.FormFields("tbxM5").Result)
If numF5 > numM5 Then
...
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
>Here is my code, which is running as I exit a formfield (neither "tbxF5" or
>"tbxM5"):
[quoted text clipped - 16 lines]
>
>TIA
zSplash - 07 Jun 2005 17:28 GMT
Works fine now, with your help. Thanks, Jay.
st.
> It's a little hard to say without seeing the values you're comparing,
> but I'll guess that it's saying something equivalent to 11 < 2. The
[quoted text clipped - 37 lines]
> >
> >TIA