TheFunkSoulBrother
asked on
Calling a method in a subform
Hi experts,
I've got the subform "mySubForm" in "myMainForm".
And in mySubForm there is the following function:
Public Sub JumpToRecord(rec_id As Long)
DoCmd.GoToRecord , , acFirst
While myID.Value <> rec_id And Not IsNull(myID.Value) And Not myID.Value = ""
DoCmd.GoToRecord , , acNext
Wend
End Sub
But calling JumpToRecord from myMainForm doesn't work.
mySubForm.Form.JumpToRecor d 4 --> Runtime error 2105
Me.Controls("mySubForm").F orm.JumpTo Record 4 ... doesn't work either.
Dim obSubform As Form_Plan
Set obSubform = Plan.Form
obSubform.GotoPlan 4 ... same problem
Runtime error 2105 means ~ You can't jump to the record.
But I'm sure the record with myID=4 exists.
I've got the subform "mySubForm" in "myMainForm".
And in mySubForm there is the following function:
Public Sub JumpToRecord(rec_id As Long)
DoCmd.GoToRecord , , acFirst
While myID.Value <> rec_id And Not IsNull(myID.Value) And Not myID.Value = ""
DoCmd.GoToRecord , , acNext
Wend
End Sub
But calling JumpToRecord from myMainForm doesn't work.
mySubForm.Form.JumpToRecor
Me.Controls("mySubForm").F
Dim obSubform As Form_Plan
Set obSubform = Plan.Form
obSubform.GotoPlan 4 ... same problem
Runtime error 2105 means ~ You can't jump to the record.
But I'm sure the record with myID=4 exists.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have u tried doing a setfocus so focus is on that child window, then DoCmd.Goto knows which form to work on