Home All Groups Group Topic Archive Search About
Author
29 Jan 2006 8:32 PM
Pinto1uk
Hi, can anyone tell me why the following line of code does not work. It works
for example whenever the txtAmount > 1. but if i enter enter anything below
1, the code does not perform the way i want. the code does not work when i
play around with decimal numbers.

If txtAmount.Text < Val (txtTotal.Text) Then ...

regards

Author
29 Jan 2006 8:56 PM
Lance Wynn
try

If Val(txtAmount.Text) < Val (txtTotal.Text) Then

"Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message
news:A9B41128-DC8E-4FF3-BB80-02F3C8A9AAFE@microsoft.com...
Hi, can anyone tell me why the following line of code does not work. It
works
for example whenever the txtAmount > 1. but if i enter enter anything below
1, the code does not perform the way i want. the code does not work when i
play around with decimal numbers.

If txtAmount.Text < Val (txtTotal.Text) Then ...

regards
Author
29 Jan 2006 9:11 PM
Pinto1uk
Hi, ive tried that with no luck. the problem occurs only when the total is
less than 1. eg £0.90. and when i try and enter 0.95, the calculation becomes
errornous.

regards

Show quoteHide quote
"Lance Wynn" wrote:

> try
>
> If Val(txtAmount.Text) < Val (txtTotal.Text) Then
>
> "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message
> news:A9B41128-DC8E-4FF3-BB80-02F3C8A9AAFE@microsoft.com...
> Hi, can anyone tell me why the following line of code does not work. It
> works
> for example whenever the txtAmount > 1. but if i enter enter anything below
> 1, the code does not perform the way i want. the code does not work when i
> play around with decimal numbers.
>
> If txtAmount.Text < Val (txtTotal.Text) Then ...
>
> regards
>
>
>
>
>
Author
29 Jan 2006 10:20 PM
David Clifford
try
If Val(Mid((txtAmount.Text), 2)) < Val(Mid((txtTotal.Text), 2)) Then

I think that it may be the "£" that is the problem

Show quoteHide quote
"Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message
news:D1B60C4C-A90F-4EA2-958E-5CE232172D79@microsoft.com...
> Hi, ive tried that with no luck. the problem occurs only when the total is
> less than 1. eg £0.90. and when i try and enter 0.95, the calculation
becomes
> errornous.
>
> regards
>
> "Lance Wynn" wrote:
>
> > try
> >
> > If Val(txtAmount.Text) < Val (txtTotal.Text) Then
> >
> > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message
> > news:A9B41128-DC8E-4FF3-BB80-02F3C8A9AAFE@microsoft.com...
> > Hi, can anyone tell me why the following line of code does not work. It
> > works
> > for example whenever the txtAmount > 1. but if i enter enter anything
below
> > 1, the code does not perform the way i want. the code does not work when
i
> > play around with decimal numbers.
> >
> > If txtAmount.Text < Val (txtTotal.Text) Then ...
> >
> > regards
> >
> >
> >
> >
> >
Author
30 Jan 2006 9:38 AM
J French
On Sun, 29 Jan 2006 22:20:38 -0000, "David Clifford"
<sarpg939tNoSpam@SomeISP.com> wrote:

>try
>If Val(Mid((txtAmount.Text), 2)) < Val(Mid((txtTotal.Text), 2)) Then
>
>I think that it may be the "£" that is the problem

Yes,  Val( "£100" )  is zero

The OP would be better off disallowing or removing non numeric
characters