Forms :: Referencing Controls On Subforms
Oct 23, 2014
In the attached picture has a representation of my setup.
My main form has a listbox search form (taken from this site). The search results populate data in subform1.
In the detail section of main form has subform1 with 3 cascading combo boxes. I have queries set up that run the cascading combo boxes.
In the detail of subform1, I have subform2 with a combo box.
Today I decided to merge my search form and the other forms so I wouldn't have two pages. Everything used to work with no errors - but I can't figure out how to reference everything properly now.
I've tried every combination from here to reference things properly. Somehow, I'm missing something.
View Replies
ADVERTISEMENT
Mar 30, 2012
I have a main form, 2 sub forms, and 2 text-boxes on the main form. I have a search box now for the first subform. Works perfectly. Once the users filtered based on name, I want them to be able to select that filtered record which would filter another subform.
Right? ok.
My first attempt was to assign the ID that was selected to a textbox on the main form, then automatically requery the second subform based on that value. I used this way on my search box. I'm sure there is a way to go directly from clicking the value to requerying the second subform, but i don't know it.
That being said even the indirect first attempt isn't working. It all has to do with the ".", "!", and ordering of this stuff. It has to do something with Parent child, but beyond that I'm at a loss.
Code:
Me.[Collateral] = Acct_Reference_id
Me.[Navigation]![textbox] = Acct_Reference_id
...
'Me!Subform1.Form!ControlName
'Me!Subform2.Form!ControlName
'Me.Parent!ControlName
I did find this very useful site [URL] ...... It shows what code you can use depending on where you are and what you're doing. Even with that as a resource, i'm still at a loss.
View 7 Replies
View Related
Jan 15, 2014
I have a complete working timeclock and trying to add the forms within the navigation form. I know I have to go back and re-reference everything and have already done so with the queries. But I cannot get the setfocus to work.
Here is the setup.
NavigationForm (navigation form)
frmClockIn (top form)
frmClockIn_SUB (bottom form)
Open Navigation > Time Clock.
Select an EmployeeID from the dropdown
Click on clock in. (successful)
cboEmployeID goes blank and try selecting the same employeeID to clock out and I get a debug at
Me.frmClockIn_SUB.SetFocus
I think there is a problem with my cboEmployeeID_AfterUpdate() as well.(related?) which used to be
Private Sub cboEmployeeID_AfterUpdate()
me.refresh
End Sub
I have replaced "me.refresh" with "Me.frmClockIn_SUB.Form.Refresh"
(It used to break here, but not after I changed it.)
Not too sure where to set these forms to in the code
I have attached a blank copy ....
View 3 Replies
View Related
Feb 16, 2007
Hello,
I need some help with a piece of code for a db.
This code checks to see if the last three characters on a ControlSource.Tag property are "Req" and if they are, tests if it's null or = 0 and if it is then it outputs a msg box stating that the control.ControlSource is required. It does it for every control on the main form.
This has worked.
Now, i need to allow for multiple subforms to be located on the main form along with their controls being tested as well. I want to start another loop for each time the conrol on the mainform is a subform.
I have that done so far by using "If TypeOf ctl Is SubForm Then..."
This is the part i need help with. I want to search all of the controls on the subform when it is a subform. I need to search all of the controls on the subform then, and i'm not quite sure of the syntax.
I've tried various somethings like SUBFORMCONTROL.Controls but that hasn't seemed to work...
If someone could help me, that would be wonderful!
View 4 Replies
View Related
Apr 15, 2014
I have a form with four unlinked sub forms on - I am hoping to
1) add a value from one subform to another and more importantly
2) update 1 subform when the other is amended...how exactly do I reference subform 2 from subform1.
I have tried me.parent!form2 and forms!mainform!form2.requery etc but can't get it right
View 7 Replies
View Related
Aug 25, 2004
So I swear what I want to do isn't that difficult....ok so I can't get it to work, but I'm sure one of you gurus out there can. I hope =) At the very least tell me if it’s possible to do.
I have a form (Edit Expert) on this form is a combo box with a list of all the experts names. Below is a tab control with 2 tabs. Each tab has a subform on it with different info pertaining to experts. (contact info and education) what I want to happen is that when someone selects an expert, I want that experts info to be populated into the subforms. I have tried a macros (findExpert) that is attached to the after update property of the combo box. When there isn’t a tab control on the form and there is only one form, it works great, with tab control it says my filter isn’t based on a table or query and to use selectObject. However I have no idea what object to select. I have read the word doc that is floating around the forum about the syntax for main/subforms, but have gone in circles. However I am reasonably sure that that is were my problem is. I need to tell access to apply the filter to the subform on the tab control.
I tried to zip my db, but no matter what i do it's too big, so i hope this is enough info for you to go on. Please let me know if you need more information. Thanks a billion for your time and effort!! - me
View 11 Replies
View Related
May 8, 2006
Hi there
I've got 3 tables related to one another with one to many relationships. They are:
21_Category
22_SubCategory
23_Indicator
where the 23_Indicator table has 22_SubCategory as its parent and 21_Category as its grandparent.
The forms wizard in Access has nicely developed a form with 2 subforms contained on it which does the trick for maintaining all 3 of these tables. The form itself displays 21_Category, subform1 displays 22_SubCategory and subform2 displays 23_Indicator. When I change the active record for either Category or Subcategory the subforms change their display as expected. All good.
My concern is that the form looks a mess and not very welcoming, too much info on one form, so I'd like to replace the 2 subforms (or even form plus 2 subforms) with one Tab Control. So far I can get the linking working correctly to the first page within the Tab Control but cannot link the second page child records to the active record in the first.
I'm using the Link Child Fields and Link Master Fields to do this. Even straight copying of the entries from my subforms which already work cannot get the Tab Control to behave in the same way.
Without wasting any more time on this, does anyone know whether it is easily possible or I'm missing something obvious? I suspect I've got something slightly wrong with either the Source, Link Child Fields, or Link Master Fields syntax, or referring to the wrong objects. Alternatively, Tab Controls just aren't designed to show one to many type records??
I'm not a VB Developer so if this isn't possible without writing a whole heap of code then I'll just have to cut my losses and use the crowded form I already have, though I'm happy to insert a few lines to get the Tab Control to work.
Thanks for your help in this. Apologies if this has already been posted loads before. I'm doing this as voluntary work for a charity and I'm a fairly new user of Access and VB (though I'm familiar with databases and SQL).
View 1 Replies
View Related
May 31, 2014
How to reference a value on a combobox in one form from an object on another form.
I have put in =Forms![Company Name].Combo7 in the field object on the form and I have got the ID autonumber of the Company Name. So far so good. It worked.
When I put in =Forms![Company Name].Combo7.column1 to get the company name to appear in the field I got an error.
What is the correct entry that needs to be entered?
View 4 Replies
View Related
Aug 12, 2015
I Open my Form
frm_process_ppl (single form)
which has the datasource as qry_process_ppl_2
on this form is a subform (continuous)
frm_process_ppl_orig
with the same data source linked by [ALINK].I want to run an append query when I click on one of the controls of the subform.On the subform there is a uniqueID called [LNK]
In the append query I have the following criteria for the LNK field [Forms]![frm_process_ppl]![frm_process_ppl2].[LNK]..However it is not working.I think my criteria is wrong.
(This worked fine with just one form but I have had to add an additional subform and the original form was continuous. I cannot add a subform to a continuous form so I decided to creat a single form to house the continuous form) I just cant reference what Im clicking in my query !!
View 2 Replies
View Related
Oct 19, 2006
I am trying to limit the number of records displaying in a subform [amendedLoans] by selecting only those records that have the same ClientID as the mainform [Customers] and the same loan number as the subforms parent form [ClientAccounts loan changes].[loanno].
I have no difficulty selecting records just using the clientid but as soon as I add the reference to the subform [loanno] field I get no selection of records. I suspect there is an error in the where clause for
[Amended Loans].Loan)=[Forms]![customers]![ClientAccounts loan changes].[Form]![LoanNo]) .
I have built the clause using the expression builder and have had many attempts all ending up with the same result. I'm now at a loss as to where to go from here....
View 7 Replies
View Related
Apr 1, 2014
I want to be able to do something to several labels, e.g. make them invisible, using a FOR loop. They are all named similarly, with ascending numbers on the end, e.g. lblName20
Say I want to make lblName20 to lblName40 invisible. I need something along the lines of:
Code:
Dim labelname As String
For c = 20 To 40
labelname = "lblName" & c
labelname.Visible = False
Next c
Of course, that doesn't work, because it doesn't recognize the string as a label name. How do I go about this?
View 3 Replies
View Related
Jul 8, 2014
I know this is simple, but I feel like Simple Jack this morning. I'm trying to take the text from a drop-down menu and use that as part of the form caption. However, the text is not what is bound, the ID number is.
View 4 Replies
View Related
Jul 3, 2013
I have a form that I want to filter by different fields on different occasions. i.e., I might look at all records that have a review date of earlier than today on one occasion and I might look at all records that have a Yes in a Yes/No box on another occasion (date then being irrelevant.)
I have finished the form which has a query as it's Record Source.
The only way I can figure out how to accomplish my goal is to copy/paste the form with a new name, copy/paste the query that is it's record source, with a new name, and then put the criteria I want in the new query and make that query the new form's record source.
Is there a more elegant way I can do this. For example. I have a form consisting of buttons that I use as a Navigation Form. Could I, in the VBA that opens the form when I click on it's button, stipulate which Record Source the form would use?
View 3 Replies
View Related
Jun 24, 2015
I have a form and subform with the following names:
frmBasic
sfrmCustomers
I have a unbound txt field called txtCustName on the mainform
I want to populate this field from a field on the subform called CustName when the record is selected.
I also have an unbound combo box with the cust ids using the row source from the tables record source from the main form.
I tried the following Code:
Private Sub cboCustNum_AfterUpdate()
Me.Filter = "[Cust_ID]=" & cboCustNum
Me.FilterOn = True
Me.txtCustName = Forms.frmBasic.sfrmCustomers.Form.CustName
End Sub
This didn't work. So I put "= [Forms].[frmBasic].[sfrmCustomers].Form.[CustName]" in the control source of the text box on the main form I want populated.
The name doesn't appear in the field. I get #Name? in the field.
View 4 Replies
View Related
May 28, 2014
I have an issue with a BeforeUpdate procedure that I am trying to get working. I'm using simple elements here as this is a test DB, not the real one yet.
I'm trying to get the value from a Text Box TextData into a string cString. I've used a Dim statement to declare cString - I think the problem I am having is trying to get the actual data from the form. The error I am getting is:
Run Time error '2465'
Microsoft Access cannot find the field "|1" referred to in your expression.
The code I am using is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim cString As String
cString = [Forms!FormData!TextData]
End Sub
(I've removed some code that is either comments or working since I have to retype things!)
The line cString = [Forms!FormData!TextData] is where the debugger highlights as the error.
View 3 Replies
View Related
May 29, 2015
I have an Access 2010 Database frontend to SQL Server 2008 Backend. So far there are 3 Tabs in the Navigation System. The first one is the primary Data Entry form which has a tab control with 3 subforms.
Here's the problem. The database is designed to track potential members based on different types of Ads. The primary Data Entry form holds all of the demographic data for the person that called in response to an ad. The first tab has a subform to track how many times that person has contacted us. The second subform tracks which advertisements the person is contacting us about and the third tracks which Events that person attended. There is no correlation between contacts, Ads and Events.
On the Advertisements we have about 7 different types of Ads we do and each ad can be run multiple times on different days. We want to be able to track which Ad the person contacted us about. The Advertisement subform has a comgo box for the Ad type and a combo box for the ad date. the source for the combo box for the ad date includes the combobox for the adtype as the criteria. That criteria is what's giving me the problem. I've used:
forms!mainmenu!navigationsubform.form!potential_me mbers!frmAdvertisements!cboadvid
Along with every other variation I can think of. The form itself is frmAdvertisements but I'm using it in a tab control and I also tried:
forms!mainment!navigationsubform.form!potential_me mbers!adv!cboadvid
View 6 Replies
View Related
Jul 1, 2014
The database I have created is to produce product description sheets. From the switchboard, the user clicks a button that opens a form on which they can enter about 5 bits of information , then select the product they wish to produce the product sheet for and when they click a button, the product sheet is produced. The product sheet is a report with a subreport. The information entered on the form is included with more information from the database on the main report and the subreport is based on a union query which combines information from 2 tables to list the items included in this product. (the information the user inputs into the form is information that changes depending on the situation and is not stored in the database.
Now comes the next step in this process. Just as the information input into the form is temporary information, there is also one bit of information that needs to be input on a temporary bases for the items that are listed on the subreport. Each of the items on this subreport needs an assignment of AAA or BBB that needs to appear in the subreport on the line with that particular item. There can be one item in an product, or there can be many and the listing of AAA or BBB can be different from one item to the next or they could all be the same. The assignment needs to be made on an item basis.
My thoughts on this were to have a subform appear once the user selects the product on the form which would list all of the items and allow them to select either AAA or BBB in a column on this form. Then when the click to open the report, those assignments would carry through to the report.I have been able to create a continuous form displaying all of the items based on the union query but that's as far as I can get. Not even sure if that is the way to go.
Is there a way to reference the AAA and BBB input on the subform I described so that it displays in the report.
View 7 Replies
View Related
Oct 23, 2013
I have a multi select list box which I am trying to use to open another form and apply a filter based on the user's multiple selections.
List box - lstCatergories
Main Form - frmSuppliersSummaryCategories
Subform on Main Form - frmSuppliersSummaryCategoriesSubForm
The Subform contains the text box CategoryID
Here's my code which nearly works...
Code:
Private Sub cmdFilterSuppliers_Click()
On Error GoTo Err_cmdFilterSuppliers_Click
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
[Code] .....
My problem is that the control "CategoryID" is on the subform and I'm having massive problems trying to reference it. This is the part of my code that won't work:
Code:
DoCmd.OpenForm "frmSuppliersSummaryCategories", acNormal, , "CategoryID IN(" & strWhere & ")"
However; if I open the SubForm directly it works perfectly. I.e.
Code:
DoCmd.OpenForm "frmSuppliersSummaryCategoriesSubform", acFormDS, , "CategoryID IN(" & strWhere & ")"
To summarise... How do I reference the control "CategoryID" on the subform "frmSuppliersSummaryCategoriesSubform"?
View 4 Replies
View Related
Nov 22, 2013
I have several Suppliers, each of whom holds several SalesEvents. At each SalesEvent I might buy none, one or more Bundles. Each Bundle then contains one or more Items. These relationships are all reflected in my Access 2013 desktop db as one-many relationships with cascaded updates.
My form structure for data entry reflects the Relationships, in that I have a Supplier form with a SalesEvents subform. On that subform I can enter data about each of that Supplier's SalesEvents, and each SalesEvent row has a button to call up a SalesEvent form which has a Bundles subform. Then each row of that subform has a button which calls up a Bundle form containing an Items subform. That Bundle form identifies the Supplier, Sales Event and Bundle number, and within its Items subform I can then enter the data for each Item.
Problem : All used to work fine, but I've clearly changed something because now when I select the Items button on the Items subform in the Bundle form, the system gives me the data for the first record in the SalesEvents table, rather than the one selected. I have checked the raw data and that's as it should be. I have tried to undo all the steps I took since it last worked properly, but to no avail. Restoring the last backup (taken when I'm sure it worked properly) still has the problem.how do I find what data is actually being passed between forms and subforms ?
View 3 Replies
View Related
Jun 2, 2005
Hello,
I want to use a tab form where the user can click add, search, and edit records all from 3 tabs. The problem is I only want to be able to add data on one form, edit data on another, and just read only on the search. This seems to cause a dilemma, how can I specifiy them to add, edit, and read only on one form using tabs?
Mateo
View 1 Replies
View Related
Oct 31, 2013
I am making a database that will be used by multiple people on a network, and they have different resoloutions on their own computers. when the database is loaded on their respective computers, the form controls are all off.
On the computer i designed them on, the forms fit perfectly on screen, as do the controls, i would like to know if there is some vba code i could incorporate into the form open event, or module code that i can use in order to dynamically re-seize the forms and all of the controls to suit different resoloutions?
View 6 Replies
View Related
Feb 4, 2006
I forum could someone tell me:
I have an unbound form on that form I want to put three sub forms one on a products table the other on a course start dates table and the link table that joins the other two together. all three are related to each other with Pk/FK links.
When I try to link them it says you cannot link items on an unbound form.
regards in advance
Peter:eek:
View 1 Replies
View Related
Mar 8, 2013
I have a main form with multiple subforms in tab view, right now the forms only open in edit mode, I would like all forms to open to new record mode. I know I can set the main form with the switchboard manager but what about the subforms?
View 2 Replies
View Related
Jul 2, 2007
I am attempting to create a database for my users to input new data via a main form. I have this main form where I use subforms as look up tables/queries to pull my stored data from. My problem is that I want to try and not have the subform on the main form; I want it to be its own window. Bear in mind I am new to using Microsoft access, and trying to learn as I go.
I have created all the forms with queries. I use the open form command to get me to my subform, which is a common findings form. From there I am able to search and filter, and once I find my desired record I want to be able to link certain fields back to the main form. (basically if possible use a command button to select this information and insert it on the main form). Typically, my users will have a generic finding to to record so I have inputted these findings so that they can select them and not have to type them themselves. Is this even possible for me to do this way, with a command button by writing a VBA code and linking criteria? The reason I am creating a separate form is so that the main form is not cluttered and is user friendly.
The fields I want to link are the same, however they are not from the same queries, and essentially the main form has its own since as of right now there is not data because it’s run of user input. The findings form has data. There are relationships established.
Thanks for any help, I feel like this might be confusing since I am unsure of exactly what I am trying to do, but any help would be greatly appreciated.
View 3 Replies
View Related
Feb 8, 2005
Okay. I am trying to build a form where I could get information like this but also editable. It can be either bound or unbound with enough information to update the records. I could do this several other ways but would prefer it just like it is below. Any ideas is greatly appreciated. Sam.
REPORT_NAME_1
Active(y/n)
ELEMENT_1 Included(y/n)
ELEMENT_2 Included(y/n)
ELEMENT_3 Included(y/n)
REPORT_NAME_2
Active(y/n)
ELEMENT_1 Included(y/n)
ELEMENT_2 Included(y/n)
ELEMENT_3 Included(y/n)
REPORT_NAME_3
Active(y/n)
ELEMENT_1 Included(y/n)
ELEMENT_2 Included(y/n)
ELEMENT_3 Included(y/n)
View 1 Replies
View Related
Mar 3, 2005
I have a complex form (in that it contains a lot of VB code and events) to display the information of various articles in my database. I would like to add some browsing options to the form (like a list of all articles on the left, and some different back/forward options), but I also need to preserve the form in its current state.
Rather than make a new copy of the form (and have to maintain TWO near-identical copies of the same form), I attempted to make a new form, with just the browsing list, and insert the old article information form as a subform on the left. However, it seems that any of the code from the original form which refers to Forms!Article Information!Article_ID ("Article Information" is the name of the original form) are not able to load the correct information, as I am prompted to supply it myself. Needless to say, I don't want the user to be prompted for the article number each time they open the form :).
I'm wondering how I would go about opening the old form as a subform in such a way that I am not prompted each time. Or alternativley, if there's a better way to do what I'm trying to do, how should I do it?
View 7 Replies
View Related