Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 106
  • Last Modified:

Microsoft Access 2010 Subform question

How do I create a function to go to subform to subform?
I would like to double click a record and jump to main subform
Database41.zip
0
Hiroyuki Tamura
Asked:
Hiroyuki Tamura
  • 2
  • 2
3 Solutions
 
[ fanpages ]IT Services ConsultantCommented:
Sorry, what would you like to double-click, & what would you like to happen after this?

You only have one sub-form in your database at present.

Q_28966718
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can set the focus to a Subform, but how you do that depends on WHERE you're doing that, as fanpages suggests.

If you're doing this from the parent form, then you simply do this:

Me.NameOfYourSubformControl.Form.SomeControlOnThatForm

Note that NameOfYourSubformControl may or may not be the same as the name of the form you're using as the SourceObject of that control, so be careful. This trips up a lot of people!

If you have two subforms on the SAME parent form, then you have to first refer to the Parent, and then the other subform:

Me.Parent.NameOfSecondSubformControl.Form.SomeControlOnThatForm

If the subforms on on two different parent forms, then you have to refer to the Parent form of the second subform via the Forms collection:

Forms("ParentFormOfSecondSubform").NameOfSubformControl.Form.SomeControlOnThatForm
0
 
Hiroyuki TamuraAuthor Commented:
sorry, would you give me sample database? not sure where i should put the script.
0
 
Hiroyuki TamuraAuthor Commented:
> what would you like to double-click, & what would you like to happen after this?

is there a way to put a button on subform?
after clicking, jump to related record on other form.
0
 
[ fanpages ]IT Services ConsultantCommented:
is there a way to put a button on subform?
after clicking, jump to related record on other form.

You could have a button on the main (parent) form that, when clicked, retrieves the [ID] from the currently selected row in the subform, & uses that as the source of a secondary subform (displayed elsewhere on the parent), or as the source of a new form (not a subform of the current parent form).

If you would like to add a second subform to your example database, & change the "Table1" form to show both subforms, then I/we can advise you how to use a button to link both subforms together.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now