I'm building a multi-page form with subforms for a number of tables. The form is to collect very detailed information about patients, and the patientID is included in several tables.
Can the patient ID input from the main form(master table) populate a hidden field with the same patient ID in subsequent subforms?
Thanks for any assistance.
As Parfait stated the answer is yes... (at least if I understand your question correctly) You can bind these fields together using the subforms Link Master/ Child Fields Properties as circled in red
But Note: If you are using a Navigation Form this same Parent/ Child linking does not exist as these sub forms are filtered. If that is the case you will have to handle this differently probably using vba.
Related
This is my data model:
.
Can anyone please explain, how I can make a Form in MS Access, which works in the following way:
There is a dropdown list from which a user selects business unit (Business_Unit_NAM).
After the selection, on the same form, the respective records are shown below, for example, Service_Request_NAM, Service_Request_Description_NAM, Phases, Subphases, Status.
A user can scroll through every of the created records and change the value in the fields.
A more detailed explanation would be extremely appreciated.
Thanks!
You can create a form with Business_Unit dropdown (unbound) and with subform based on TBL_Star_Requests. Link this subform with dropdown control using Link Master Fields and Ling Child Fields properties. That should be enough for requested functionality. If the dropdown on the main form will be unbound, Subform Field Linker will give an error, but it will work anyway if you add field names manually. You can use the Linker if you temporarily will bound the main form to TBL_Business_Units table and bound the dropdown to Business_Unit_ID field. Remove bounding when linking done.
If you create a form on a table that has 1-M relationship with another table, MS-Access creates the form containing the fields of the "1" side as text boxe, etc. and for the M-Side, a tabular structure is created.
What is the name of the control representing the tabular structure? (it is some kind of a list but it is not like the list you select from the tool box!). This control does not have a click event. Why? It only has ON ENTER and ON LEAVE events, so how to capture the current row?
It is a form within the main form AKA sub-form. Although it appears to be a grid-view (Access call it datasheet view), it isn't. Therefore it does not have row based events. However, the sub-form has all the events like a normal form would.
There are few limitations in this "dataSheetView", no other controls are visible except text boxes. If you need a button, you must have a textbox with click events. Ideally place the textbox as first/last column so you have your action buttons.
Access also has a "ContinuousFormView" which can be decorated like a gridview with all custom controls. Again, they are forms and do not have row based events. Only control based or form based.
The object next to the question mark is a Subform/Subreport Container Control. As its name implies, it is a container that holds other objects which can be a table, query, form, or report. This control is also available for selection from the 'toolbox'.
Best to give the container control a name different from the object it holds, like ctrDocuments.
What do you mean by 'capture' the current row? A row is not referenced, fields and controls are referenced. Several ways to approach referencing fields and controls (if a form or report) of the dependent object. How depends on where you want to run the code. In a query? In the main form events? In the subform events? For example code in Click event of a button on the main form could be like:
strDoc = Me.ctrDocuments.DocPK
tldr: I want to create a form where specific fields from specific records are displayed based on filters or parameters. I do not want to use a subform or multiple item form.
the context: I am creating a database with information about different countries. My table Indicators (picture 1) contains country names, indicators names (e.g. Population, GDP, ...) and the respective values. I will collect data on the same indicators for every country.
I want to create a form where I can select a country, and then display the values of the indicators are for that country (picture 2).
I do not want to use a multi item form, because I want to create a visually appealing layout.
I have made a sketch of my data table
And the form I want to create
EDIT: Actually the form should look more like this, i.e. not a tabular layout.
I would be greatful for any suggestions how to build such a form.
You can start with the form wizard to generate a simple data-bound form from your table. Then you can change it to show one record at a time, make all the controls read-only, and add a combo box to select the country and add a little VBA event handler to the combo box so that whenever its selection changes, the form navigates to the record for that country. Of course, in a form you can customise the layout to show indicators in any style you want. So this approach should fulfill all your needs.
With very little effort, I can get the following form and subform:
A little more tampering with the layout, and you can have exactly what you want.
To fill in various boxes, you can use DlookUp and you can use a recordset to write to your textboxes, but it is all quite messy.
I am busy developing an MS Access 2007 application that requires the use of subforms with quite a complex user interface. I am aware on how to create a parent form and link to a subform so that it shows data relating to the parent form record, but my question is this:
If I have multiple nested subforms (say 3 or 4 levels down), can I somehow link a subform sitting on the 4th level with the record of the parent form on the 1st level? What I mean by nested subforms is having a form pasted inside a form, pasted inside another form, etc.
The subform that I wish to link with the parent form is currently using a query as its source object and the reason for using nested subform is purely for the aesthetics of the user interface.
Is there a simple way to go about this? Or perhaps using VBA?
One thing that many people don't realize is that the LinkChild/LinkMaster fields can actually be any valid expression. So, you could have subForm1's LinkChild/LinkMaster properties be:
LinkMaster CustomerID
LinkChild CustomerID
Then subForm2 could have this:
LinkMaster subForm1.Form!InvoiceID
LinkChild InvoiceID
...and so forth. I can't imagine going much deeper than that, but it's possible.
You might also consider if a cascading datasheet form might do the trick, using subdatasheets. You can even have a datasheet display a non-datasheet form as its subdatasheet (something I disconvered entirely accidentally when I switched a a parent form having a subform into datasheet view -- the subform remained displayed in form view). With subdatasheets, you don't have any issues with number of forms, or the limitation on embedding continuous forms.
If this is purely for aesthetic reasons (it looks pretty to you or someone else), rather than functional reasons, why not just use a rectangle, with a "Sunken" Special Effect?
I will preface this with saying, this is my first time using listboxes and earlier posts were criticized for lacking detail. So, all help is greatly appreciated and I hope this is enough information without being overkill.
Currently, I have a listbox updating a junction table with an on click event (iterates through selected items and if they are not in the table it adds them). The list box is also updated by an option group (based on the option group value a query populates the list with the appropriate items and they are selected/highlighted based on the junction table). Also, when items are a "sub-category" the "category" is also selected. This functions perfectly until I ask it to do more...
Problem 1: I need to differentiate "categories" of items from each other. So, I have included a blank item to the list box to add a space between categories. When the blank items are present the listbox does not update the junction table properly and vice versa.
Problem 2: My users want to be able to deselect the "category" under certain circumstances. This is fine, just de-select the "category" after the "sub-category" is selected. However, the "category" is re-selected whenever the listbox is clicked again because it iterates through all entries.
Perceived solution for both problems: Return only the index of the item (de)selected and manipulate accordingly. Is this possible? If so, how?
OR: Should I take a different approach?
One can think of a list or combo box as a low-resource sub-form. Conversely, one can use a sub-form to take care functions usually handled with a list or combo box.
I don't understand all that you're trying to do, but I do know that "up-sizing" to a sub-form is usually the answer when a simple control (for whatever reason) can't cover the need.