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
33 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
  • 2
  • 2
5 Comments
 
LVL 35

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 35

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

822 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