compile error - expected expression

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!
 
K

Klatuu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top