The expression On Click you entered as the event property setting
produced the following error : Return without Gosub
Seems to me havin gthe VB window opened or closed should make no
difference. Either I have a return or I don't. I don't...
Private Sub Command37_Click()
On Error GoTo Err_Command37_Click
Dim stDocName As String
stDocName = "Load MLR Spreadsheets"
DoCmd.RunMacro stDocName
Exit_Command37_Click:
Exit Sub
Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click
End Sub
Have you tried it without making the sub private?
Does it make a difference?
Tom Lake
I'm not sure what's causing this behavior, but maybe it isn't in that form
itself. With all forms closed. explicitly compile the project (in VBA
Editor, click Debug -> Compile). Are any errors found? If an error is
found, the erroneous line of code should be highlighted.
If nothing is highlighted, maybe there's something in the macro, "Load MLR
Spreadsheets", that depends on the VB Editor being open. What are the
actions in that macro?
--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html
(please reply to the newsgroup)
Phil
This happened to me with every button on the switchboard, and then when I
open the VBA window and close it again, it seems to work. Until I close the
database and then when I reopen it, the same problem occurred. (I think this
started happening after I performed a defrag on my PC and it seemed to 'lose
the connection' the pointer or something). Anyway, on the very first button
on the switchboard, I just removed the "private" from the first line of code
so that it just starts with 'Sub Command' and voila! It worked. I can now
close the database and reopen it without incident. Strange but true...
"Phil Smith" wrote:
> .
>