Why wont this code work!!

ThunderBolt

Registered User.
Local time
Today, 06:52
Joined
Apr 29, 2003
Messages
25
Private Sub Grade_A_AfterUpdate()
If [Grade A] <= [Grade B] Or [Grade A] > 100 Then: Rem Too low
MsgBox ("Invalid Grade Boundary. Please Check And Try Again.")
[Grade A] = Null: Rem Clears box
[Grade A].SetFocus: Rem Places cursor
End If

End Sub

It keeps saying there is an end if without a block if???
 
Is it because there's no 'Else'?

Either way taking out the 'End if' should work
 
Thunderbolt,

I don't have Access available now ...

What are the ":" for ? Is that supposed to indicate that
there is another statement on the same line?

Try putting a space before the colon.

I would code like:

Code:
If a = b Then    ' some comment

Wayne
 
The 'rem' statements are annotations,the ':'areneeded to signify that the rem statements are not part of the working code. I took the end if out but now it just rejects all values i enter on the form??
 
Grade A and Grade B need to be Grade_A and Grade_B me thinks!
 
it was the 'rem' statement interfering with it, i erased the 'rem' statements and it worked, phew! thank goodness!
Thanks for the help guys, efficient as usual!
 
You need to validate using the Before Update event of the control ....

You then use the "Cancel" argument of that event to stop the control from loosing focus.

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom