Mathematical dunce?

Parker

Registered User.
Local time
Today, 01:18
Joined
Jan 17, 2004
Messages
316
I have the following code trigered by an event on a form

Dim CRLimit As String
CRLimit = Me.CRLimit 'Get value for CRLimit

If CRLimit <= Me.Total_VAT Then 'compare string to a value on form

Forms!frmCompanies!AccountOnHold.Visible = True ' present lable
Else
Forms!frmCompanies!AccountOnHold.Visible = False ' don't present lable
End If

It did work

But now it can't add up!

If Total_VAT has any value above 0 then code displays the lable "Account on Hold"
If Total_VAT has 0 then no lable is displayed

I have put a watch on for both Total_VAT and CRLimit and they are getting the correct values.

I have tried refering to the string first and the form value first and it still behaves the same way.:confused:
 
Jan, if CRLimit is a control on your form, don't declare it as a string.
If me.CRLimit <= me.TOTAL_VAT then...
The logical evaluation will be accurate if both the values are numbers, not strings, and neither is null. Your "math" will display your table if both values are 0. Do you want that? If not, which one(s) must be greater than 0?
 
Last edited:
Sorted

Doh

Truth be known, it must have always been doing this but it only showed up when I was testing against a fully poulated db.

String value had been set earlier for an experimental sub and when I decided it wasn't doing what I wanted I just modified it to do something else. Never thought about both values having to be numbers.

Ok, so I was having a senior moment! (Or a blonde one) I'm allowed.

I am old enough and I'm blonde so take your pick:D

And no wories about Null or 0 values because in this instance they can't happen --- a CRLimit has to be set for an account on setup . Cash sales are against our licence regs. So evry account is an invoice account and must have a creddit limit . Easy.

Now it works proper I can use it as part of a routine to not only warn the op. but to lock the booking screen against a client.

Thanks Billyr

Pete
 

Users who are viewing this thread

Back
Top Bottom