SELECT tbl1.ID, tbl1.a, tbl1.b, tbl1.c, tbl1.Formula, funResultat(tbl1.a, tbl1.b, tbl1.c, tbl1.Formula) AS Resultat
FROM tbl1;
Public Function funResultat(aValue, bValue, cValue, strFormula As String) As String
Dim strLitera As String
Dim i As Integer
Dim strResultat As String
If Len(strFormula) > 0 Then
For i = 1 To Len(strFormula)
strLitera = Mid(strFormula, i, 1)
Select Case strLitera
Case Is = "a"
strResultat = strResultat & aValue
Case Is = "b"
strResultat = strResultat & bValue
Case Is = "c"
strResultat = strResultat & cValue
Case Else
strResultat = strResultat & strLitera
End Select
Next i
funResultat = strResultat
Else
funResultat = vbNullString
End If
End Function
|