Referring To A Subform Control
Nov 15, 2004
I know how to refer to a control on a form by using [forms]![formname]![controlname], but can anyone help with referring to a subform.
I have a subform called subPrograms, on which is a combo box whose contents need to be filtered depending on the selection from another combo box on the main form.
The combo box on the main form is cboDivisions.
The combo box on the subform is cboPurchasers
Main form is called frmMain
Subform is called subPrograms
The user is supposed to select a Division, and then depending on that selection the contents of cboPurchasers will change to only show those that are within that same division.
I would also like to know how to update the cboPurchasers when the cboDivision has been selected? Can someon help?
I hope that this is enough info.
View Replies
ADVERTISEMENT
Aug 14, 2014
I have a form with a subform which resides in a tabbed control. In that subform, I have a textbox in the footer that sums values in the detail section of the subform.
I have a textbox on my main form that should display the same data that is in my subform footer textbox, but it is giving me the #name? error.
This is the expression in my subform footer textbox (which returns the correct result):
TxtSubtotalHQPCalc -
=Sum([ActualHQPCalc])
And the expression in my main form textbox (which returns #name?):
txtActualHQPValue -
=([subfrmHQPProject].[Form]![TxtSubtotalHQPCalc])
I have verified that my subform name and textbox names are all accurate. This is very frustrating because I am using this exact same method in a different database with no problems!
View 3 Replies
View Related
Feb 22, 2013
I believe I did this before awhile ago but for some reason I keep getting an error.
I have a Mainform (frmMain) that has a Subform (frmSub). On frmSub I have 2 comboxes (strCom1 & strCom2) one is set to invisible (strCom2.Visible = No).
So using the "On Open Event" of frmMain I want make strCom2 visible if strCom1 = "Read Only". Ofcourse I will also need to place the vba on the On After Update event. Below is what I have so far but doesnt work.
I get Run-time Error 2427 "You enetered an experssion that has no value"
Code:
Private Sub Form_Open(Cancel As Integer)
If Me!frmSub.Form!strCom1.Value = "Read Only" Then
Me!frmSub.Form!strCom2.Visible = True
Else
Me!frmSub.Form!strCom2.Visible = False
End If
End Sub
View 5 Replies
View Related
Jun 9, 2013
I have the following setup:
A main form - named [formMain]
On [formMain] I have a tab control - named [tabMain]
[tabMain] has 3 pages named [pageOne], [pageTwo] and [pageThree].
On [pageThree] I have created a subform named [formSub].
On [formSub] there is a tab control named [tabSub].
Now what I would like is to make [tabSub] (in)visible if the user switches from [pageOne] or [pageTwo] to [pageThree].
Code:
Sub tabMain_Change()
How do I refer to [tabSub] from within this subroutine? I am trying something like:
Code:
Forms![formMain]![pageThree].Form![tabSub].Visible = False
but it is not working. What should be the correct way?
View 2 Replies
View Related
Jul 3, 2006
Just a quick question, I can't seem to get this right (as usual :confused: )
I have a form and I want the label in the header to display the text from a field in a related subform. I have tried the following syntax to no avail:
=[Forms]![sfrmCompanyName]![LastName]
Any suggestions
Thanks in advance
Nicolas
View 2 Replies
View Related
Nov 30, 2006
I want my subform to allow additions. I would like the default value for one of the fields in the subform to be the value chosen in the combo box that is used to select which records are shown in the subform. The row source for the combo box is
SELECT tblLicensee.LicenseeID, tblLicensee.[Licens#] FROM tblLicensee;
where LicenseeID is the key field and Licens# is what is displayed.
If I refer to the combo box for the default value for that control on the form…
=[Forms]![frmFindRecord]![Combo37]
the key value (LicenseeID) is entered as the default instead of the value displayed in the combo box (Licens#). How can I set the default value to record the Licens# instead?
View 1 Replies
View Related
Mar 3, 2015
I have a form with a subform that has a table on it. The subform table is a price list with the fields Description, Details (which is hidden as it's too big for the table) and Price.
I want to be able to double-click on a chosen item from the table to display a pop-up showing the same details but with the Details field shown. I have the pop-up in place but I am struggling with displaying the chosen information.
How do I reference the fields on the chosen line in the table?
View 6 Replies
View Related
Jul 21, 2014
I have a form named frmMain that contains five buttons that lead to subforms, one of which is named frmDeceased.
In frmDeceased, I needed to create a combo box that relied on selections from the combo box before it. I was able to do this successfully in frmDeceased, but then today when I opened the database and opened frmMain, I realized that the query fails when frmDeceased is opened via frmMain. It works perfectly if I just open frmDeceased directly.
The first combo box is ROHE and the second is Iwi (which is dependent on the Rohe selected).
The query for Iwi has this criteria: Forms!frmDeceased!cbo_ROHE
When I open frmDeceased through frmMain, I get the 'enter parameter value' message showing "Forms!frmDeceased!cbo_ROHE".
I tried changing this query to: Forms!frmMain!frmDeceased!cbo_ROHE, but it didn't work.
View 14 Replies
View Related
Mar 5, 2013
I have an Access 2010 application and I'm having trouble referring to properties in my subform withon a Navigation form. Based on a selection in a Combo Box, I need to change the filter on the subform. The relevant forms are:
Main Navigation Form = frmAdminNav
"Standard" Navigation Subform = NavigationSubForm
My Subform = frmShowInventory
How do I refer to the Filter property on frmShowInventory?
View 2 Replies
View Related
Apr 17, 2013
Go to frmInvoice, and you'll see a Net Total box (txtNetTotal) . It's control source is linked to a textbox in the subform fsubInvoiceDetails2 called txtStocktotal. It basically just pulls up all the costs associated with that InvoiceID.
The reference mechanism is as follows: =[fsubInvoiceDetails2].[Form]![txtStockTotal].Now...sometimes this works and sometimes it doesn't! Sometimes i've had to use: =forms!fsubInvoiceDetails2!txtStockTotal.
It seems to be very temperamental at times and i'm not fully confident if this can be explained.By way of note, I use express builder normally to input these statements: I go to Forms > ALL FORMS > fsubInvoiceDetails2 > txtstocktotal.
View 2 Replies
View Related
Aug 3, 2006
OK. I have searched and searched and every thread dances around similar situations but none seem to address this particular one. I am trying to make a control on a sub form visible/not visible depending on the condition of a control on a main form. The catch is that the control I'm trying to change the state of is on a subform located in a tab control. I've tried a thousand combinations and none seem to work. How do I reference the control on the subform in a tab control?
Main Form: frmMemberMain
Tab Control: TabCtl12
Tab Control Page: 2
Subform: frmChildren
Control on subform: txtRelationship
Can someone please help before my brain explodes!! Thanks! :eek:
View 5 Replies
View Related
May 27, 2014
On a main form i have a continuous subform listing Jobs.
On the Click Event i want to display the personnel and equipment separately in two additional subforms linked to the Job i have clicked on by JobID.
I have tried all sorts of references and currently have this:-
Forms!PersonnelAndEquipmentMovementFrm.PerEquipMov Jobs.JobID = Form!EmployeeSubform.JobID.Text
Which does not work?
View 4 Replies
View Related
Apr 26, 2005
I had a form with two tabs and then added a subform into a third tab. Until I added the subform I could see the tabs at the top in both the design view and the form view. However, since adding the subform, althougth the form looks OK in the design view, when I switch to the form view the tabs are missing. The only way that I am able to get to them is to tab through all my fields until it eventually seems to shift the page up and I can see them. If I switch to another tab and this stage I then have to go throught the same proccess of going through each of the fields until I can see the tabs again.
Hope this makes sense and someone can help!
Sam
View 2 Replies
View Related
Aug 22, 2006
How do you tab out of one subform and into another from the main form. I have 3 subforms and after a user is finished entering data into the main form the first subform sets focus. After data is entered into the subform it’s impossible to hit the “enter” or “tab” key to move onto the next subform.
View 3 Replies
View Related
Feb 25, 2006
I have two forms, ctrlpanel and users. ctrlpanel is acting as the main form and users as the subform. In a module, I have the following code inside a function that is called on in the users subform:
Code: With Forms![ctrlpanel]![users].Form!cmbSection .RowSource = strList .RowSourceType = "Value List" End With
Can't seem to figure out why I get this error. Have tried a couple different ways of doing this with the same result. here is the error:
"Microsoft Access cannot find the field 'users' referred to in your expression."
users isn't a field, it's the subform and the syntax above is how many sites show how to refer to the subform.
JMH
View 1 Replies
View Related
Nov 16, 2007
I have a subform on my main order form. I would like to click a button on my main order form and have it change a control on the subform. For instance, I have 2 controls on my subform, control 1 is a text field, and control 2 is a yes/no box.
When i click the button on my main for order form, I would like it to evaluate control 1 on my subform so that it can adjust control 2.
I would like to see if control 1 is null then set control 2 to yes or true. Thank you in advance for all your help.
View 4 Replies
View Related
Jan 18, 2008
Hi,
how can i focus on a subform control? my main form called form A has a subform called form B. Form B has a button that, when is clicked, starts a new record for Form B source. all works ok while editing form B but when i open Form A and run the same macro, i get an erro saying Form B is not open.
my macro reads-
GoToRecord
object Type Form
Object Name Form B
Record New
the button is placed on form B which is sub form to Form A.
any help really appreciated.
Nigel
View 4 Replies
View Related
Mar 1, 2005
This is probably simple, but I can't figure it out.
I have a table called Household that has a one-to-many relationship with a table called Individuals. The Individuals table has fields called FirstName and LastName. I have a main form based on Household. I want to have subforms in a Tab control based on the Individuals table. So when you click Page 1, it shows the data for the first person in the household, and when you click Page 2, it shows the data for the second person in the household. This would work by basing the subform on Page 1 on a query that finds the Min of FirstName, and basing the subform on Page 2 on a query that finds that Max of FirstName. However, the data in the subforms would not be updateable, because queries based on aggregate functions are not updateable.
Does anyone have any ideas as to how I can accomplish what I'd like to do?
View 5 Replies
View Related
Aug 9, 2005
I've use a set up that works fine on a form but doesn't when used in a subform. Basically, i have a check box and txt box that won't allow anything to be written in it unless the check box is checked. If it is checked and nothing is inputted in the text box, the lostfocus event for the txt box flags the user. It works fine in a normal form and when it's a subform, the lostfocus event does fire when going to another control in the subform. The problem is that it doesn't fire when going to another control not in the subform. Is there anyway I can get the lost focus event to fire under these circumstances?
Thanks,
scratch
View 1 Replies
View Related
Nov 10, 2005
Ok, I'm new here and I've searched through the forums and found similar questions asked but no one ever seems to have an answer. I've also looked on other forums and still no solution. So here goes...
I have a tab control with several tabs. On half of these tabs are subforms and the other tabs just have text boxes. When you click the any of the tabs, the entire tab control shifts to the bottom of the screen. The user would have to manually scroll up to continue inputting data.
I added a .gotopage method to the tab control and that fixed the problem in that when you click on a tabbed page, the page is positioned correctly on the screen. However, if I click on a tabbed page which contains a subform, I now get a VB error which says invalid page number argument.
If anyone has experienced this or knows a fix, I'd really appreciate it. Thanks! :confused:
View 6 Replies
View Related
Sep 29, 2006
I am in the process of upgrading a database, mostly by borrowing things I like from a similar database. I've borrowed a subform, along with it's underlying query and have modified my tables accordingly. All fields should match up.
Said subform is embedded on a page of a tab control. I've been modifying it regularly in design view, but when I switch over to form view, none of my controls show up. It just shows a blank yellow background.
This makes me very sad/frustrated. Please help!
View 3 Replies
View Related
Sep 2, 2004
I'm trying to check if a control on the subform is null. I've the following line of code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Form!FrmOrderInfoMain!SubFrmOrderInfo.ItemC ode) Then
Msgbox "Empty ItemCode"
End If
End Sub
..whereby FrmOrderInfoMain is the parent form and SubFrmOrderInfo is the subform. I get an error for this code as Im not sure what is the correct code to use. Thanks for the help.
Swee
View 7 Replies
View Related
Dec 16, 2004
I have a control called TotalPaid in a subform Footer section that sums up payment Amounts in the Details section. TotalPaid's control source is simply =SUM([Amount]).
That's it. Nothing tricky, I'm not summing up calculated controls or anything...
PROBLEM: TotalPaid frequently displays "#Error".
I can determine absolutely no reason for this. It is inconsistent, and is not specific to any certain subform records or mainform records. If I go to the next mainform record and then go back, the #Error will often disappear, to be replaced by the apprpriate SUM value.
Is this an Access 2000 bug?? I need to know what causes this and what I can do about, since the value in TotalPaid is VERY important to many of my other calculations. When it gives an #Error, my whole app becomes worthless.
View 4 Replies
View Related
Nov 26, 2013
I currently have a form with a combobox that I want to use to control a subform that I have inserted. Both the parent form and the subform are pulling data from a different table. From the combobox, I want the user to be able to choose a persons name, and then the subform will display each project that the person has worked on based on the name that has been chosen. The reason that I have a subform is so that the user is able to click through projects that pertain to a certain employee. I have the master fields and child fields linked on the employees name as there are not to many employees and the names are all unique.
View 3 Replies
View Related
Nov 4, 2014
I have a form that incorporates 2 subforms. I have all but 1 thing working as intended. I have setup a button to submit the entries (and handle a few other control functions) but I need to validate a single control within the first of the 2 subforms. This should be simple but it seems I am missing something. I just need to check for null or blank and if true open a message box to explain that it is a required field and to then exit the sub without any further execution. My problem is that no matter how I type the code I cannot get it to recognize the control (which is a combo box). Even identifying the from the control is on does not seem to work.
View 1 Replies
View Related
May 15, 2015
I am trying to set a value to a control in my subform (On Load) but it is not working.
FRM_ASQ has a button upon clicking open a FRM_Planchange_Input which has a subform FRM_PlanChange_Input_Details.
On Load - I assign values to controls in the FRM_Planchange_Input and I am trying to assign values to control in the subform FRM_PlanChange_Input_Details.
On Load,
SetPropery -
Control Name: [Forms]![FRM_Planchange_Input]![FRM_PlanChange_Input_Details].[Form]![ASQ]
Property: Value
Value: =[Forms]![FRM_ASQ]![ASQ #]
I am copying the data in Form ASQ to Subform Plan Change Details. Whenever the macro is run, it gets stuck at the point giving an error "The control name is misspelled or refers to a control that doesn't exist. If the invalid control name is in macro, an Action Failed dialog box will display the macro name and the macro's arguments after you click OK."
Upon clicking OK, i get Error Number 3021 - Arguments [Forms]![FRM_Planchange_Input]![FRM_PlanChange_Input_Details].[Form]![ASQ]
The syntax I used is based on this article: Forms![main form name]![subform control name].Form![control name]. I also read that Subform Control Name and Subform Name are not the same?
View 3 Replies
View Related