Locale Issues When Using A Vb Script S’abonner

0
Avatar
Legacy Poster

Hello 

I amy trying to produce a tag that includes VAT from a SQL query to db that collects the data without it. No problems untill I start to add the VAT. All data comes through, and I get the right formatting on the field/label. 

 

But as soon as I try to get the data using VB and adding the calculation *"1.25" the issues start. I have tried both to get te data as VB and to use VB to calculate the correct answers from a Db connection. I have plaid arround with most any setting I can dram up and no matter what I do I have problems with locale. 

 

My end results end up being either of two scenarios: 

- Amounts less then 1000 (999.00) ends up skipping the the decimal marker and printing the amount times 100! and amount above 1000 (1,000.00) prints just fine

- Amounts less then 1000 (999.00) prints just fine and amounts above 1000 (1,000.00) ends up printing as just a fraction of the value (1/100 of value i think it is. 
 

I am hoping that I am missing something very obvious. Any idea? 
 

/Jens

5 commentaires

0
Avatar
Michael Toupin (mtoupin
Actions pour les commentaires Permalien

We'd need to see the whole script to get an idea of what the issue could be.  Please attach the label format here so we can have a look at it.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Good idea. Here it is :)

Sample data is less then one thousand in this file.


VB script is simply value=value*"1.25" 

0
Avatar
Michael Toupin (mtoupin
Actions pour les commentaires Permalien

I'd do it:

 

Value = Cint(value) * 1.25

 

Make sure that the value is an integer, and use the 1.25 as an integer instead of a string.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Oh, yeah, thanks. It does change the way it reads the value from db. But it doesnt give me the right value, nor does it print. It gives me an error message: Type missmatch 'Cint' 

Attached scrn

Any idea whats going on?

 

Is there any way to ad a *1.25 directly to the sql statement instead so I dont have to do VB scripts for haps?

But it still reads the data wrong from db.

values 1 to 999 becomes 100.00 to 99900.00 now 

values 1000 and up becomes 1.00 and up

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

Could you create a sample database (text file, or Microsoft Access) and let us know if you can still reproduce the same behaviour? If yes, please attach the database sample to this topic.

 

You could also try to make use of the "FormatNumber()" VBScript function to format your number always with the desired amount of decimals. Will this help?

Vous devez vous connecter pour laisser un commentaire.