I have two sub-forms on a main form in access 2010. I want it to be that when I select a record in one of the sub-form, the other sub-form shows a related field.
For example, when A record (date) is selected in one sub-form, The notes (a memo field) should display in the accompanying sub-form.
What it is that I have a table that users make notes in one field is for the date and another is for the notes. I want to create a sub-form that displays only the notes (form B) when the date is selected in a sub-form (Form C) on the same form (FormA).
I need it this was as the main form allows for users to search for some values whic will populate Form C.
In the OnUpdate event, just reset (or refresh) the record source of the subform with the notes. I'm assuming the notes subform has a recordsource that is a query?
Related
I have a MS Access form and subform, the subform is linked to the Form, while for each project (Form) there is 3 type of visits (Monthly, Quarterly & Annually). What I require that for each project, I want the subform to show the 3 options automatically (in the combo box), and the user should fill the FF Hours and FA Hours Subform
Good day,
You can achieve it by the following steps.
Create a table to store the visits(add three records for monthly, quarterly, and annual). In my own case, i called the table projectvisit.
For the main form, in my example i created a table called site
For the subform, i created a table called sitedetails
Then i created an insert query that will insert 3 records(from the projectvisit table into the visittype field in sitedetails table, for the active main form record)
I create a macro that has 3 actions
A. Open query(run the insert query)
B. Gotonextrecord
C. Goto previousrecord.
Finally i added a command button to the mainform that runs the macro.
Find attached images of the tables, query, form,and macro. You can modify it to meet your needs.
Do take note that before the command button will run the macro, you must have populated the current record of the main form.
Also, go to access options,advanced tab and uncheck action queries.
I have a little problem here. I've a database with one table for Users and one for changes in progress for these users. They are in a 1:n relationship (one user can have many changes but one change only affects one user).
I output my users in datasheet view and have the changes in by standard collapsed subrows of this datasheet. The user shall be able to order the users by the number of ongoing changes matching the filters in this sub-form. Therefore i have to get the number of rows in this form.
in the subform i have a field called "Anzahl" (german for count) representing the number of elements currently shown in the sub-form and i have a field called SubFormAnzahl in the parent datasheet.
Now i try to access this field via
=[Changes_Subfrom].[Form].[Anzahl]
and i am getting a #Name? error.
Why does this happen and how can i prevent it?
With main form set as datasheet, it can't see subform textbox until subdatasheet is expanded, then the calc shows. If you want to keep main form as datasheet, options are:
set main form SubdatasheetExpanded property to yes.
DCount() domain aggregate function on main form - expression in query used as RecordSource or in textbox and must use same filter criteria applied to subform
DCount("*", "Changes", "UserID=" & [ID])
Otherwise, works with main form in Single view.
I am trying to create a Form of Payments, and I want to split the actives and pasives with two subforms.
I have made it, and works! The table Payments store the values.
The actives and pasives are in a table.
ID -> Number
Description -> String
Pasive -> True/false
I have created two Forms, for actives and pasives. Each form displays the corresponding values.
Also I have created main Form that contains two subforms (actives and pasives)
When I insert a Payment
GREAT! It works!
But, when I open again the form, the values are disordered.
Can you help me?
Thanks!
I'm not sure if it understand you correctly. It looks like your subforms don't know which data is passive and which is active. Try this:
Instead of yes/no field in your table, you could rather create field with dropdown list that allows you to pick one of two values: passive or active. Let's name that field: transactionType.
Then you should add transactionType control to each subform.
In the first subform you set default value for transactionType control as a ="active", in the second subform: ="passive".
Now you can set visible parameter of transactionType controls in both subforms to no. In form view you won't see them, but if you create new record, the will add proper information to your table.
Are your subforms based on query? If no, go to subforms data source, create query based on your table and in the criteria of transactionType field set respectively "active" (in the firs subform) and "passive" (in the second one).
When you reopen
your form, thanks to query filter you have set in step 5, subforms will
display only actives or only passives. If you chose that solution, this will work for new data only. If you already have some data in your table, you should manually complete trasactionType for each existing record.
I have couple of subforms placed on main form. Mainform and subforms are linked with linkmaster ID and child ID. This enables me to place a single combobox on main form with 2 fields (my selection field+date field) which actually is bind to key ID. This combo box loads with repeated combination of both fields which is very complicated to select to find records in subforms.
I would like to know if there is possible way to place separate combobox to select myselection and another date field to enter date so that subforms are filtered based on key ID.
The table measures contains many foreign ids linked to tables containing multiple questions. The form will contain many subforms for each linked table, I'm currently only showing the linked table 'nbas_test' for clarity.
When information is entered in the subform a new record is created, how do I store the ID of the new record generated by the subform in the main table.
i.e in this case how do I store the nbas_test.nbas_ID in measures.nbas_ID.
Currently I can do this by including participant_id and timepoint _id in NBAS_test and including another combo box on the form to select the appropriate NBAS record and binding the nbas_ID but this seems a bit clumsy and unless I force my end users to do this they will likely forget.
You should be able to use the After Insert or After Update* event of the subform, depending on your requirements, to update a bound control on the parent form.
Me.Parent.txtSubID = Me.txtnbas_ID
* The After Update event also runs after a record is inserted, so you will not need both events.
Link up both fields!
On the subform -> Properties (F4) -> "Data" Tab -> "Link Child Fields" & "Link Master Fields"