Procedure call to Main Form from subform fires once but not thereafter

  • Thread starter Thread starter rwfreeman
  • Start date Start date
R

rwfreeman

Access 2003. On my subform ("sfrmExpenses") I need to use a double
click event to call a public procedure ("PopulateExpControls") on the
main form ("frmMain"). In the Formscoding discussion group, it looks
as though "Call Me. Parent.PopulateExpControls" is the proper syntax
and is the syntax I used in the subform double click event. The first
time the event fires from a newly coded procedure, the call works fine
(control is transferred to the main form) but subsequent attempts to
fire the event elicit a "2465 Application-defined or object-defined"
error with the "Call Me. Parent.PopulateExpControls" line highlighted
by the debugger.

Anybody got an idea on what gives?
 
I suspect that there is something in your PopulateExpControls function that
is causing the problem. I just set up a quickie test, using this public
function in the main form:

Public Function Hello()
MsgBox "Hello!"
Me.chkRatedG.Value = Not Me.chkRatedG.Value

End Function

and this call to the public function from the double-click event in a subform:

Call Me.Parent.Hello

This works fine for me, including subsequent double-clicks on the subform.
Try a simple test case with a message box statement in the public function.
Do you still generate the error in that case?


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
I suspect that there is something in your PopulateExpControls function that
is causing the problem. I just set up a quickie test, using this public
function in the main form:

Public Function Hello()
MsgBox "Hello!"
Me.chkRatedG.Value = Not Me.chkRatedG.Value

End Function

and this call to the public function from the double-click event in a subform:

Call Me.Parent.Hello

This works fine for me, including subsequent double-clicks on the subform.
Try a simple test case with a message box statement in the public function.
Do you still generate the error in that case?

Tom Wickerath
Microsoft Access MVPhttps://mvp.support.microsoft.com/profile/Tomhttp://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________






- Show quoted text -

Tom - You were right; there was a coding error - that sent control
back to the subform - in the procedure that was being called. Once I
took care of that, Access started doing what I wanted it to do.

Much appreciate the help and the quick response. Not so for me; I
responded (I thought) on Sunday but the message has never shown up.
Didn't want you to think I wasn't going to acknowledge your help.

Richard
 
Back
Top