VB Script to multiply a database field
Hi,
I'm hoping someone can help, we've recently installed bartender and I have basic knowledge of VB, but this is eluding me. I have two database fields on a label one is a number and the other is a text field which I want to multiply by a set number if the text matches. There are a few options for the text field, therefore I will add them as elseifs but I can't get the basic code right in the first place.
What I want to achieve is:
IF [UnitType].[Name] 'this is text = "1000's" Then
[product].[SearchRef2] 'this is a number x 1000
Many thanks in advance,
-
You probably need to make the field a Visual Basic Script type set as an Event Controlled Script and perform the VB OnNewRecord.
When you want to reference the fields, you need to double click on the field in the list of Database fields in the column on the right (Script Assistant I think it is called) so you would have something like
If (<Database field name and parameters>) = "1000's" then
Value = (<second database field etc>) * 1000
etc.
0 -
HI Pete,
Thank you, I have got it working now. The field type was set to text so I had to use CDbl to convert it.
All the best,
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare