compile error - expected expression

  • Thread starter Thread starter JohnLute
  • Start date Start date
J

JohnLute

I'm trying something new and not sure if I'm on the right track. I have an
unbound text box on a form and I'm trying a calculation in the AfterUpdate
event:

Private Sub BlankArea_AfterUpdate()
If (Me!BlankLengthUOM = "in.") Then
([BlankLength]*[BlankWidth])/144
End If
ElseIf Me!BlankLengthUOM = "mm" _
Then
([BlankLength]*[BlankWidth])*92903.04
End If

End Sub

The debugger is pointing to the "*" in both lines.

Can anyone straighten me out with this? Am I on the right track at all?

Thanks!
 
Your syntax is not correct. You have an End If where it should not be.
Also, you should always qualify your controls so Access knows what they
belong to. You are also not assigning the cacluation to anything. And leave
a space before and after the *

Private Sub BlankArea_AfterUpdate()
If Me!BlankLengthUOM = "in." Then
Me.SomeControl = (Me.BlankLength * Me.BlankWidth) / 144
ElseIf Me!BlankLengthUOM = "mm" Then
Me.SomeControl = (Me.BlankLength *Me.BlankWidth * 92903.04
Else
'What do you do if Me!BlankLengthUOM is neither of the above choices?
End If

End Sub
 
Back
Top