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
18 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 34

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 119

Expert Comment

by:Rey Obrero
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 34

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now