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
39 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 36

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 36

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

821 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