Hi,
I have a form for Importing parts lists into my database, however the format
of each is different, some have just List price & some list & cost, so I have
a series of Comboboxes so the user can select column name, operator +_*/ and
a textbox for a value between 0-100 (%).
I am trying to find a way to display sample data in text boxes to show the
results of the selected calculations, but I can't figure out how to pass the
operator as a variable.
Sample code;
Me.txtExCost = (Me.lstSample.Column(lngCol)) & strOpCost & (sglPerCost *
(Me.lstSample.Column(lngCol)) / 100)
returns '2.85-0.285' not 2.565 where
(Me.lstSample.Column(lngCol)) returns 2.85
strOpCost = -
sglPerCost = 10
How do I get round this?
mscertified - 17 Jan 2008 20:55 GMT
You cannot perform arithmetic using an operator in a variable. You will have
to 'decode' the operator in code e.g.
Function OpResult(op1 as long, oper as string, op2 as long) as long
select case oper
case "+" OpResult = op1 + op2
case "-" OpResult = op1 - op2
end select
end function
-Dorian
> Hi,
>
[quoted text clipped - 18 lines]
>
> How do I get round this?