From: gagecres on
I just made a couple of minor changes to my database and now I am getting
this message when I try to open my main form: "The expression On Current you
entered as the event property setting produced the following error: Return
without GoSub." The only changes I made were to move some buttons and text
fields around. I didn't even touch the code I had in On Current. This code
was working fine until I made these changes. Any idea of what I might have
done to cause this error?
From: Tom van Stiphout on
On Thu, 1 Apr 2010 07:28:02 -0700, gagecres
<gagecres(a)discussions.microsoft.com> wrote:

You forgot to post the code in the OnCurrent event.

You can also test this by temporarily write:
Exit Sub
as the first line of the OnCurrent event.

-Tom.
Microsoft Access MVP


>I just made a couple of minor changes to my database and now I am getting
>this message when I try to open my main form: "The expression On Current you
>entered as the event property setting produced the following error: Return
>without GoSub." The only changes I made were to move some buttons and text
>fields around. I didn't even touch the code I had in On Current. This code
>was working fine until I made these changes. Any idea of what I might have
>done to cause this error?
From: gagecres on
Here is the code:

Private Sub Form_Current()
If DCount("*", "Probate Notice Table") = 0 Then
Me.cmd_Prvw_PR_Ltrs.Enabled = False
Me.Command75.Enabled = False
Me.cmd_Pnt_Wksht.Enabled = False
Me.cmd_Del_Rec.Enabled = False
Me.cmd_View_by_county.Enabled = False
Else
Me.cmd_Pnt_Wksht.Enabled = True
Me.cmd_Del_Rec.Enabled = True
Me.cmd_View_by_county.Enabled = True
End If
End Sub

Here's a new twist. I cut this code from the program, then saved and closed
the database. Then I reopened it and pasted the code back into OnCurrent and
the error went away. The problem is, I emailed a copy of this database to
myself at home and when I tried to open it there I got the error again. This
is driving me crazy. Please help.

"Tom van Stiphout" wrote:

> On Thu, 1 Apr 2010 07:28:02 -0700, gagecres
> <gagecres(a)discussions.microsoft.com> wrote:
>
> You forgot to post the code in the OnCurrent event.
>
> You can also test this by temporarily write:
> Exit Sub
> as the first line of the OnCurrent event.
>
> -Tom.
> Microsoft Access MVP
>
>
> >I just made a couple of minor changes to my database and now I am getting
> >this message when I try to open my main form: "The expression On Current you
> >entered as the event property setting produced the following error: Return
> >without GoSub." The only changes I made were to move some buttons and text
> >fields around. I didn't even touch the code I had in On Current. This code
> >was working fine until I made these changes. Any idea of what I might have
> >done to cause this error?
> .
>