?
Solved

Calling a method in a subform

Posted on 2006-05-30
2
Medium Priority
?
207 Views
Last Modified: 2009-07-23
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.JumpToRecord 4  -->  Runtime error 2105

Me.Controls("mySubForm").Form.JumpToRecord 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.
0
Comment
Question by:TheFunkSoulBrother
  • 2
2 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 16788444
Is the procedure u defined public?

Have u tried doing a setfocus so focus is on that child window, then DoCmd.Goto knows which form to work on
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 720 total points
ID: 16788473
calling it seems fine

try this

mySubForm.SetFocus
mySubForm.Form.JumpToRecord 4
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question