I keep getting this error during an on exit event in a form created in Access2000. Does anyone know what this error is and how to correct it?
Thanks In Advance
Printable View
I keep getting this error during an on exit event in a form created in Access2000. Does anyone know what this error is and how to correct it?
Thanks In Advance
It means you tried to put and END IF and it does not have a matching IF statement above it. Try matching your IF and END IF 's up.
Nias,
Thanks for answering so quickly. However it is the only If statement I have and there is an if with the end if yet I still get this error.
I am relatively new to VB and have never taken a formal class on the topic.
My Library is limited and I am trying to learn Access2000 at the same time. Last version used was Access 2.0.
Here is the Code I am running:
Public Sub Business_Status_Exit(Cancel As Integer)
If Business_Status = "Yes" Then Ma_Business_Info.show
End If
End Sub
What I want to do is have a new access form open if Business_Status is = "Yes" else to nothing. Can you still help?
Thanks again
Try putting the code behind the THEN statement on a line by itself.
IF condition THEN
do this
ELSE
do that
END IF
Change your code to look like this:
Public Sub Business_Status_Exit(Cancel As Integer)
If Business_Status = "Yes" Then
Ma_Business_Info.show
End If
End Sub
I think your problem is that VB does not want an End IF if the entire if statement is on one line.
You could also code it this way:
Public Sub Business_Status_Exit(Cancel As Integer)
If Business_Status = "Yes" Then Ma_Business_Info.show
End Sub
Thanks That was the problem.
It still doesn't work but that error is gone.