I have several controls on this form in addition to a tab control with 3 separate pages. I want the subform(s) within each page to requery when a value is selected on the page above.
So for the purposes of explaining this..
I have an event On_Click() on a field called Address_ID. It's meant to take tha value of that ID in addition to two other IDs, Cust_ID and Location_ID, and requery the subform Order_Sub within the Orders page.
I've named the tab control pretty blandly, just tabCtl.
So far I've tried every way imaginable to reference the subform, but to no avail.
Forms!Record_Details!Orders!Orders_Sub.Requery
That doesn't work, but I assume that it should. What gives?
Steve
You do not need to reference the tab control in your code. Just reference and requery the subform itself
Forms.Record_Details.Form.Orders_Sub.Requery
Related
I'm quite new to MS Access but understand basic dvl concepts. I have a form (SalesOrder) where I can create sales order info. Creating a new sales order populates more than one table.
I'd like to have a two search buttons on the bottom of the form that will display the results of a query (search by customer name or order id). The results of the query need to be displayed in a subform, and once I click on the selected row, it should populate the master form fields with read-only data (i'll have an edit button to change to writable).
Do I simply link a query to the subform? If so, how do I do that? and how do get the event in the main form (the search button click event) to trigger action in the subform?
thanks in advance.
jeff
Here's my scenario:
I have a a main table, Projects, with a o2m relationship to a second table Changes. This second table is quite wide so I would like to be able to segment the information across several subforms on different tabs.
I've created a main form, the tabs and the subforms on each tab and the presentation is fine. The problem comes when I create a new record. On the first tab (containing subform1), I create a new record and fill in some values. When I click on the second tab (subform2), the new record is not there. My question is how can I keep the different subforms all in sync?
I've tried to do a Requery of subform 2 using the OnClick event on the second tab but to no avail. I could be just doing that incorrectly.
Any ideas please?
Thanks,
Jon C
I am new in Microsoft Access. What i want is to switch between forms in subform panel depending upon the user selects from drop down list. Attach file contains what i want
I google alot but didnt find any help. Thank you for your help.
Here is screen shot. but I am confused in finding control of subform.
Forms("frmMain").Form.subFormControl.SourceObject = "SubForm_2_A"
..should be all you need.
subFormControl is the name of the subform-container-control that contains Subform2.
frmMain is the name of the parent form, not labelled in your picture (actually, you might not have to put subform1 in a subform really, its content could be on the parent form).
EDIT:
The red frame marks a subform. Click on -1- to make sure the main form has the focus. Then click once on -2- and the control is selected, and its properties show up in the properties box on the right.
Note that you find the "source object" in the data page and the name of the control in the "other" page. Access makes the name (of the control) the same as the form, which is really not such a bright idea and rather confusing.
I created an Organization form in Access 2007 that could be used to display any record in the Organization table by clicking the navigation buttons that appear at the bottom of the form when it is in "Form View". Next, I created a subform within the Organization form to display records from another table that have a foreign key from the Organization table.
Now the "Default View" property of the Organization form has been automatically set to "Single Form" and when I try to set it to "Continuous Forms" I get the following message:
You can't view a form as a continuous form if it contains a subform, an ActiveX control, or a bound chart.
Set the DefaultView property of the form to Single Form, Datasheet,
PivotTable, or PivotChart.
Furthermore, I am unable to use the form to view any records other than the first record in the Organization table. How can display other records from the Organization table in my form using record IDs?
While investigating this problem, I discovered that Microsoft's own Northwind Traders Sample Database contains at least one form with subforms that exhibited the behavior I wanted, even in the "Single Form" view. This suggested that the subform was not the cause of the problem.
In trying to reproduce the affect accomplished in the sample database, I recreated my form and re-added elements too it one-by-one, testing the navigation at each step. I was able to view different records via the "Form View" navigation button until I added controls from a table other than Organization that weren't contained within a subform.
So there you have it; switching between a form's source records via the navigation controls in "Form View" does not work when the master form contains records from more than one table.
I'm scratching my head whether this idea is worth exploring:
I'd like to use a tab control to filter a subform field by the value of the tab control page. There are about 5 different values for that field, so it would be neat to have 5 tabs where you click on the tab and see the list of just those matching records.
I'm a bit of an Access 2007 neophyte (haven't designed a DB with Access in years), so these are the problems that need to be solved with this approach.
Is it possible to have the same subform show on every Tab control page?
What's the most efficient way to link the value of the tab to the subform query?
I realize the brain-dead way to do this is simply create a separate subform for each page, but this seems rather inefficient. Or is it?
If you're filtering the same data, you don't need five copies of the subform, you just need to trigger a change of the Recordsource of the subform or apply a filter to it.
There are two approaches I'd consider:
use a tab, but use it just as a tab strip, with the subform not embedded on any page of the form, but below it. In the tab's OnChange event, filter the subform appropriately.
use an option group with toggle buttons and in the AfterUpdate event, filter the subform. This will look just like the tab control with the Style property set to Buttons.