Modules & VBA :: Get Names Of Subforms In Tab Control
Nov 13, 2014
I have a main form that has a Tab Control. The tab control could have 5 to 10 tabs. Each tab has a subform and in some instances a tab could have a tab inside that tab with subforms as well. I want to be able to get the subform names in each tab.
I am able to get the main form name by using me.form.name
How can i get the names of each subform in each tab?
I am creating a dynamic form and need to get the names into variables for later use...
I am creating a query that retrieves data from one table and creates a second table. I want to name the columns in the new table using the contents of the controls from a form within the same mdb. The form will be open when this query is run, but I am having trouble creating and saving the query.
Here is a sample of what I am trying to do...Any help is greatly appreciated!!
Thanks
SELECT IndividualHolidays.SU, IndividualHolidays.SSN, IndividualHolidays.Init, IndividualHolidays.LName, Max(IndividualHolidays.NewYearsDay) AS Forms!HolidayDatesEntry!NewYearsDay, Max(IndividualHolidays.AftNewYears) AS Forms!HolidayDatesEntry!AftNewYears, Max(IndividualHolidays.PresDay) AS Forms!HolidayDatesEntry!PresDay, Max(IndividualHolidays.AftPresDay) AS Forms!HolidayDatesEntry!AftPresDay …<etc> INTO HolidaysByEmp FROM IndividualHolidays GROUP BY IndividualHolidays.SU, IndividualHolidays.SSN, IndividualHolidays.Init, IndividualHolidays.LName;
I had 2 forms before, so I decided to make it easier and joined them together using tabbs, first tab is student info, the second is student cources. Since student cources relate to student info I have made it as a subform of student info. But the problem is that when I click on student info tab or student cources tab , the view scrolls down, and it gets frustrating. Is there any way to stop it from scrolling down.
When a record is created with by the form an autonumber Id is generated
I want to pass this ID to each of the subforms so that the tables can all link
Form-1 Table-1 AutonumberID Subform-1 Table-2 AutonumberID from table-1 (can be new field in table) Subform-2 Table-3 AutonumberID from table-1 (can be new field in table) For all subforms and tables
I need to create a table with names of controls on my forms.
I'll use that table to apply user rules.
Any solution to write the table automatically using VBA code ?
I know how to populate a combobox...
DoCmd.OpenForm YourFormName, acNormal, , , , acHidden Dim c As Control For Each c In YourFormName.Controls [Control-Name].RowSource = [Control-Name].RowSource & c.Name & ";" Next c
I have an access form (Customer) along with a sub-form (Work_done). On sub-form I have Running sum of Amount in Text box-1. I want that Total of Running sum be replaced with Main form's tables field total_amount. Is it possible that we can replace an amount of control of sub-form into main form's field?
In the default property of a subform control I want to use a control of the main form without using names of forms, but using me and parent.
I used in default property of cboVATDetail: =Me.Parent!cboVAT, but it is not accepted. My aim is to use cboVAT of parent as default in cboVATDetail of child.
I am trying to create a database for a cub scout pack that just keeps scouts information, medical info, parents info, and parents medical info each is a seperate table. I have created a Tab controlled form with 4 tabs. On each tab the ONLY thing I have is a subform that contains the appropriate information. Each table has it's own form with the table as it's record source. I link the scouts table to the medical table by SID which is a primary key in the Scouts table. I link the Scouts table to the Parents table with a PID which is the Primary Key in my Parents table, and I link the Parents with the ParentsMed with a PMedID, key in the ParentsMed table.
Question #1 - Using a Tab Control you can only have 1 record source. What should I use? I have tried the tblScouts and I have also created a query with every field from every table.
#2 - When I try to use the parent and child links on the subform I get the error "Can't build a link between unbound forms" but each form is bound to the table and the record source on the tab control has had a table and my qryEverything, neither work. I can type in SID but it still doesn't function properly.
Any suggestions or comments on a better relationship method or any insight on how tab controls are supposed to be setup or anything would be greatly appreciated.
I used the code below to check the empty fields in the form and populate it in a message
Code: Private Sub Form_BeforeUpdate(Cancel As Integer) Dim ctr As Control Dim strMsg As String 'Loop through every control on the form For Each ctr In Me.Controls
[code].....
I want the message to show the captions of controls instead of its names
The logic I'm trying to create is the following: If the number of Fuel Types is greater than two, then the field will have the value 'MPS.' Otherwise, the field will just have the regular fuel type value. It's referencing this fuel type field in the function that is the problem. I have not been able to get this working.
I have a form, frm_Master we'll call it, and on that form, within it's 'form footer' I have a tab control containing a few sub-forms, namely frm_Child.
Now, if I turn on my form footer's visibility, then the form's detail section is not shown; likewise, if the form's footer is not visible, then the detail section is.
I am trying to populate a ListBox with the names of the tables from another database. I have the following function which loops the table names from the database I want. The function is caleld on Form Load and passed into the ListBox but the List Box is empty.The message box in the function does display the table names when called from the form. I just cannot get the list box to populate.
Code:
Public Function ListTables() Dim db As Database Dim i As Integer Dim s As String Dim tdefs As TableDefs, tdef As TableDef Set db = DBEngine.OpenDatabase("C:MyPathAnalyzed Tables.mdb")
I am using Access 2007 to update a page on an external website (amongst other things) from an Access form using VBA, but that page has recently changed. I have dealt with most of the issues around this, but there is still a problem that I cannot see how to resolve. Previously all the fields on the page were uniquely named, and so I was able to assign values from my form to them using
Code: .document.all.item(fieldname).value=...
But now there appear to be identically named fields on the webpage and I cannot see how to differentiate between them in my code. I have attached a text file with the two relevant sections, containing the HTML for the two relevant sections on that page only (the code for the whole page runs to 8000+ lines and I can add the lot if really necessary) and as you will see the names for things like runs (name="result[][runs]") and wickets ("result[][wickets]") are the same in both sections. So how do I tell one from the other in my code?
Currently I have the following:
With objIE .Visible = True .... '1st innings - new HTML field names but duplicated on the webpage .Document.all.Item("result[][runs]").value = nz(Me![runs_for#]) .Document.all.Item("result[][wickets]").value = nz(Me![wickets_for#])
[Code] .....
How can I differentiate between the HTML field names in the attached file as simply as possible in my code above?
I am using Access 2013 under Windows 7. In my database I have a table, tblStock, with field names Module, Component_1, Component_2, etc. up to Component_50. I also have fields Qty_1, Qty_2, etc. up to Qty_50. These field names are not easily changed as they are constantly updated from another database. I want to create a table, tblTempBOM, using VBA by selecting a particular value of Module selected from a combo box on a form, from tblStock and creating a record with the Fields "Module", "Component" and "Qty" for each Component and Qty from 1 to 50. I am trying to use a From... Next... loop to cycle through the Component and Qty fields and store the data in the new table.
Dim strModule As String Dim strSQL As String Dim strQty As String Dim strEye As String Dim strTest As String
[code]....
This runs to the point where I try to set the value of rcd![StockCode], but the item rcdStock![strTest] has no value.Can I reference the value of the field in the rcdStock Recordset in some other way that would work?
I have an excel file on my drive with the following path "D:JsonSolve.xlsx", I only want to get "Sheet Names" and Import the sheet name into a table in Microsoft Access, how to import "All Sheet Names" from the specified path into a table, Every sheet name would be taken as a single record.
so I have a commandbutton on a form, when I click on the button I would like an inputbox that lists the subforms and subforms recordsource/ controlsource.
I have the following script which I use to modify all report settings, with an array so that I can easily list reports that I want to change the settings for, there could be 50+ reports.
I can use a string but I have to put str1 as string, str2 as string etc... whereas an array would be easier (if I knew how to do it).
Code: Public Sub ModifyAllReportsProperties() Dim obj As AccessObject, dbs As Object Set dbs = Application.CurrentProject Dim ReportName As String
I have a folder in which there are PDF files stored. Now in the Form, there is a combobox and I want the code so that when a Form is loaded then add all those PDF file names(only first 9 letters of that) in the combobox.
e.g if the PDF file name is ABCDE1990-YYY then add ABCDE1990 in the combobox. So if there 10 PDF files in the folder then add 10 names in the combobox.
I have a VBA routine that runs some queries and then creates a report as a PDF document using my virtual PDF printer. At this point it brings up the Save As dialog and I give the file a name and select a folder to store it in.
But I run this report 30 times for 30 different parameters. The parameters are obtained from a table which contains values such as Cancer, Diabetes, Stroke
-I always name the PDF file according to this value. -I always choose the same folder. -I always overwrite the reports I produced last month (copies have been sent elsewhere by then).
how can I get VBA to cycle through this code 30 times, each time selecting the next value from my table and creating/overwriting those files without the need for me to tell it the filename and path?
Code: Private Sub lstSpecialties_DblClick(Cancel As Integer)
At the moment I am running this code by double-clicking an entry in the Specialty listbox, 'but I would prefer the whole thing to run multiple times for as many Specialties as exist in the table '(currently 30 but could be more in time)
'Warnings off DoCmd.SetWarnings False 'Make the tables needed for the cumulative queries DoCmd.OpenQuery "Spec 002 Monthly recruits - part 2 - make table" Each of these queries DoCmd.OpenQuery "Spec 005 Monthly recruits - part 2 - make table" uses the Specialty selected above DoCmd.OpenQuery "Spec 022 ABF previous year - part 2 - make table" as a parameter to get DoCmd.OpenQuery "Spec 025 ABF current year - part 2 - make table" the right data for the report
I have a report that I would like to export to a folder, and I would like to include the FullName within the naming convention of the PDF. When I run the report it prompts for the Employee ID..Here is what I have so far, I'm getting an error of "Run Time Error 424 object required" on the String Report Name,
Private Sub Create_PDF_Click() Dim myPath As String Dim strReportName As String DoCmd.OpenReport "Report_Salary_Worksheet _Finalized_By_EmpID", acViewPreview myPath = "W:COMPENSPHYSICIANSComp Plans" strReportName = Report_Salary_Worksheet_Finalized_By_EmpID.[FullName] + ".pdf" DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath + strReportName, True DoCmd.Close acReport, " Report_Salary_Worksheet _Finalized_By_EmpID " End Sub
I have a form (Form1) and a in it, I have 2 subforms datasheet (Subform1 and Subform2). I have ID, First Name, Last Name in each as headers.
I need to:
1) Find the subforms 2) Loop through the subforms and get all the labels 3) Change the captions
The reason for this is because I need to have the forms bilingual. I do have a function that will translate the caption (called TranslateThisWord). I just cant figure out a way to loop through the subforms and find all the labels.