Solved

Reset subform in page control  based on selection in other page control from a tab control on a form

Posted on 2016-11-14
5
56 Views
Last Modified: 2016-11-15
I have a form:
"Main_Form"

I have a tabctrl:  "TabCtl27"

On page29 of the tabctrl27 I have a subform:
"Panel1 subform"
The recordsource is a query called "Panel1"
The main id field is called:  "Main_Id_Key"

On page28 of the TabCtl27 I have a subform:
"sp_DefaultSearch subform"
Id field is "[Master Agreement ID_Key]"
Recordsource is "sp_DefaultSearch"

What I need:
If i  double-click on a row in the subform on page28
I need the subform in page29 to filter to the same id # as i double-clicked on in page28


Thanks
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
PatHartman earned 500 total points
ID: 41886550
Change the RecordSource query of the subform on page 29 (??) to reference the subform you want to use as the controller.

Select ... From ... Where Main_Id_Key = Forms!yourform!thecontrollersubform.form!Main_Id_Key

Then in the current event of the controller subform requery the subform on page 29

Me.parent!sfrmonpage29.form.Requery
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41886589
ok pat , the subform on page 29 is  "Panel1 subform"

So if i double-click on the subform on page28..
would i not have the code in the double-click event for the subform on page 28..
instead of in the current event ?

Me.parent!sfrmonpage29.form.Requery  would this be:

"Me.parent!panel1_subform.form.Requery"

Thanks
fordraiders
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41886599
if the name of subform control  "Panel1 subform" have a space on it , you need to enclose them in bracket..

access have a bad habit of replacing the space with an underscore, and raised an error about not finding the control

Me.parent!panel1_subform.form.Requery

should be

Me.parent![panel1 subform].form.Requery
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 41886843
thnx as always
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 41888076
So if i double-click on the subform on page28..
would i not have the code in the double-click event for the subform on page 28..
instead of in the current event ?
Forms don't have double click events.
I use the Current event to sync forms.  When frmA changes records, then I requery frmB.
I use the double-click event when I want to open popup forms.  Interfaces need to be as consistent and logical as possible.    When you use cascading combos, you don't double click on the "master" combo to requery the "child" combo so I don't do it for forms either.

@Rey, it isn't a bad habit, it is Access endeavoring to accommodate the inexperienced developer.  Anyone who has ever programmed knows that variable names cannot contain spaces or special characters (and understands why) and so they wouldn't create objects or columns with those characters but Access serves all levels and in this case, Access substitutes an underscore for every non-acceptable character. It isn't random. it is consistent.  If a user creates a name
45% or $3 minimum
Then Access will convert that to
45__or__3_minimum

Notice that there are two underscores in a row in two places.

Even worse is creating names that Access is going to make identical based on its internal rules.

% Amt
$ Amt

Both of these convert to the same name

__Amt

See how Access likes that!

Bottom line is - just say no to embedded spaces and special characters except the underscore.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

617 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