I am trying to perform a simple calculation in a text box on a form. I want to use a variable in the calculation from a table. The table name is Iodine and the field name is Normality. I have the variable in the table because it changes frequently. I am trying to do this from the "On Enter" property of the text box. Could someone please help me with the Visual basic? I am not very good at it. I will post what I have written. I get a "Variable not defined error."
Thanks,
Private Sub Assay_Enter()
On Error GoTo ENDSUB
Dim Mls As Double
Dim tmpAssay As Double
Dim Norm As Double
Dim dbs As Database
Set dbs = CurrentDb()
Set tmp = dbs.OpenRecordset("Iodine")
Norm = tmp!Normality
Mls = InputBox("Enter the Mls of Iodine")
tmpAssay = Mls * Norm * 43.54
Assay = tmpAssay
'RB 11/14/06
ENDSUB:
End Sub
Thanks,
Private Sub Assay_Enter()
On Error GoTo ENDSUB
Dim Mls As Double
Dim tmpAssay As Double
Dim Norm As Double
Dim dbs As Database
Set dbs = CurrentDb()
Set tmp = dbs.OpenRecordset("Iodine")
Norm = tmp!Normality
Mls = InputBox("Enter the Mls of Iodine")
tmpAssay = Mls * Norm * 43.54
Assay = tmpAssay
'RB 11/14/06
ENDSUB:
End Sub