Microsoft Access - Create Form to Post Data to Intersection Table - ms-access

I am sincerely sorry if this question has been asked before, however with my limited knowledge of using Microsoft Access forms I am having an issue that is likely a very simple fix.
At the moment I am trying to create a form that will allow me to post data into an intersection table using combo boxes, the purpose is to create a relation between Clients and Project Numbers, these are intended on being a Many-to-Many relationship.
Relation Example
To begin with one issue I am running into is that when I use the intersection table to select a unique Client Name I get multiple entries from the drop down menu when there are multiple items in the intersecting table.
Form Example
The second part of my issue is that I am unsure how to post data to the intersecting table once the dropdown selections have been made.
Any help is greatly appreciated, and I thank everyone for their time.

The first part is to create a form in which you find, and edit data in the main client table.
This form will ONLY be based on the single main client table.
You perhaps ALREADY have a nice form to edit the client table anyway. I mean, how else will users find and edit a client anyway? So this issue and problem will LONG be dealt with before you do anything else of use in the application.
The form based on this single table might look like this:
Ok, now close the above, and create a second form to allow adding some choices of favorite colors (or in your case ClientContract). So the form will be based on this child table.
Again, like the first form, this form is based on ONE table.
Make this form continues, so click on ClientContract table, and then from ribbon choose multiple items form from the ribbon. It will look like this:
Of course we don’t want the user to have to manually type in the color (or project in your case), so we drop in a combo box from the ribbon and use the wizard. MAKE sure the first column of this combo is the PK of the ProjectNumber table, but FOR EASE of reading and selection, include ProjectNumber and Project Description columns in that comb box. NOTE in above how I also had added that combo box.
Assuming you closed and saved this form.
Now open our first main client form in design mode, and drag + drop in the continues second form we just created onto this form. The resulting form will look like this:
Access will automatic set up he customer_ID for us (because it is a sub form attached to the main form that only displays the one main record).
Once the above works, then again close the lot, and open up our continues form in design mode and remove all the extra junk.
(leaving ONLY the combo box).
The result is this:

Related

How to save row values from one field in subform to main form record? - Access

I have a parent form (frmGroupSession) that has a subform (SubFormParticipants) in datasheet view. The subform is based off a query that selects all participants ([CLIENT ID], [NAME], [ATTENDED]) that had attended a specific group [GroupID] on a specific date [GroupSessionDate]. The parent form saves to a table that logs group sessions (tblGroupSessionLog). I need to save the group's participants [CLIENT ID] to the record within tblGroupSessionLog
Basically, I need to pass data from the subform to the record within tblGroupSessionLog. I'm not sure what the most effective way to do this, if it's possible at all. Ideally, I would like to have each unique participant [CLIENT ID] stored in its own field within tblGroupSessionLog. If there were 20 participants in the subform then each row value from the first column/field [CLIENT ID] would be passed to the corresponding field within tblGroupSessionLog ([ClientID1] thru [ClientID20])
I am relatively new at this. Even asking the question was difficult.
I am not sure what else I can provide to help you wizards with the solve, but let me know and I will.
Thoughts? Ideas?
Access 101 : You have a many to many relationship You should look that term up but in short it means clients can belong to many groups and each group can have many clients. (so bang your data into a normalized structure similar to the following:
First tip make sure to add the relationships under database tools (you should look that up). Access needs to know how the tables are related to manage the keys behind the scenes and sometimes access makes better decisions about automatic form creating when it already knows the relationship structure. Once your data is properly structured access makes it easy to produce functional if much less than styling data entry forms which can also be used as even worse search forms. For instance Click on any table and hit create form on the ribbon and access will create the data entry form form you.
Basic Style tip 1: Always delete primary key fields like ClientID from the form. The field is still there in the form's record source being managed by access. Users almost never need to see any table keys. This gives you a basic data entry form which you can also use to scroll through any clients you have entered using the record selector circled at the bottom of the frmClients.
Play around with the record selector to see how it works. In particular go past the last record and you will find you can enter new clients and access will automatically give them a ClientID. You can also cycle through your Clients and update them using this form it just isn't stylish. In the same way we can make a form for the groups table.
You make a form for the frmGroupSessions table in the same manner as the others but add a step. Replace the text boxes holding ClientID and GroupID with human readable comboboxes. Here is a link to help with that: https://www.google.com/search?q=access+change+text+box+to+combo+box&oq=access+change+text+&aqs=chrome.0.0i457j0l2j69i57j0j0i22i30l2.7503j0j1&sourceid=chrome&ie=UTF-8#kpvalbx=_r0sFYJ7vBcfY5gLz2aTgBw15
Becomes:
At this point play around to learn. Use the Record Selector at the bottom of frmGroupSessions to add and modify data. Play with the Tables and see what happens. Start messing with the form properties in particular the default view. Soon you will have ideas about how the form could be better and you can start figuring out how to style them.

Access Linked Tables, how to force relational values

Hopefully the image above makes it thru. So the way this works is that a user uses a form to enter the values on the Vuln_Remediation_Planning table. After all vulnerabilities associated with a patchID and existing OS have been entered, he moves to the next form where he is suppose to mitigate the risk associated with the vulnerabilities, and you can have multiple mitigating measures which is why the table is separate.
My question:
Right now when using the compensation form, the user has to select each patchID, OS, and vulnerability ID for each mitigating measure they select... this is cumbersome and error prone. Recall the first form only operates on the planning table, the second form operates on the compensation table.. but they are related so I feel the user would want to use a single drop down to select the top the primary keys, already assign in the previous table.
I was going to ask how to handle this, but I may have solved my own problem... 3 column combo box right, with the row source coming from the Remediation planning.... lol what do you think, any other ideas?
I figured it out. On the compensation table I just created a continuous form, and moved the OS and patchID fields to the header. When opening the form normally, it looks funny because the header values change when records are selected (as would be expected if they were all on the same row). Then from the remediation planning form, I have a button to open the compensating measures form that filters it so only the patchID/OS of the parent for is shown. Additionally, in the open event of the compensating measures form, I set the default values of PATCHID/OS using open args (in case no records are there yet or the user adds new records... otherwise it opens blank when there are no records.

How Do I Make a Subform Controlled by Report (Which is Controlled by a Query) Update After Records Are Added?

I recently took a duty position that requires me to track our administrative actions. Previously, the office had tracked them on an Excel spreadsheet, and the historical data was corrupted/missing. So I have built a database in Access 2010. I designed the database to display a main form that provides an overview of each action, but decided to require most of the data to be added or updated on specific data entry forms. My question relates to two subforms on the main form that I cannot get to update after data is entered into the tables. Here are specifics:
1) The main form is the case detail form, and each case has a unique case ID number that links most of the forms and tables.
2) The Case Detail Form has two subforms. One displays the names of the people involved in the case (this is the Subject Subform). The other displays the case history entries (this is the Case History Subform).
3) Both of the subforms are supposed to work the same way. Each is populated by a report which displays the information in its corresponding Subform. In turn, the reports underlying each Subform are based on a query that selects the records to display based in the case number.
4) New data for the subforms cannot be entered on the Case Details Form. Instead, the user can press a command button which launches a separate form that allows the user to enter either subject details or to enter a case history update. Once the user enters the data, he or she clicks A Save Record button, which saves the record and closes the form window. Everything seems to work fine up to this point.
5) However, I've now been working on this project for two weeks (as time permits), and I am still not able to make the two subforms update automatically. If it's a new case record, the user can make the Subforms update by using the navigation arrows to leave the main Case Details Form and then returning to it. If it's an established case record, a refresh button that I have added to the main Case Details form will cause the two subforms to update.
As I've tried to make this work, I've tried a number of approaches that I've found on various boards. Right now, I have:
A) The Subject data entry form has a Me.Requery statement in After Insert Event Procedure
B) The Subject data entry form has a SaveRecord and a CloseWindow command that are executed when the Save Record Button On Click event is triggered.
C) The main Case Detail Form has a executes a Me.Case_Subjects.Form.Requery when the GotFocus Event Procedure is executed.
I apologize for the lengthy question and explanation. I'm an Army officer and a little out of my depth with this. I would greatly appreciate any help anyone might be able to offer.
Best regards!
I'm not sure having understood everything but I try to give you some suggestions about what to try.
If I'm not wrong both form and subforms have the case ID as field so when you created the report you should have put them in "link" by the wizard (you can set it manually after but it's a bit more tricky).
Did you do this? This makes the form / subforms update when you navigate them.
Please note that there must be a relation between the underlaying tables to guarantee that the reports / forms moves together!
This applies to the query too, just remember to include the ID field int the queries.
If you don't want to see the ID (in case you use an autonumbering id) you can set it Not Visible.
In case you don't want to link the two tables with a relation there is another solution but it's a bit more tricky and, if it's not your case, I don't want to make confusion.
Let me know if you solved.
Bye
Firstly, the line Me.Requery should be on the After Update event, not the After Insert event. Secondly, you will then need to change Me.Requery to Me.[insertsubformname].Requery.
As the user above said, you will need to ensure that you have created your database relationships properly, however if you used the Insert Subform, it should've asked you what you wish to use as your link between the forms.

Access--I need a list of dynamic check boxes on a form

I am trying to create a form in Access which will have a dynamic list of check boxes. It starts with a table tblMASTER_ATTACHMENT_LIST which will have three columns: MASTER_ATTACHMENT_ID, CLASS, and ATTACHMENT_NAME. (Before I go any further, this question is not about file attachments. Think more along the lines of an attachment to a report.) tblMASTER_ATTACHMENTS will be "pre-populated" with all possible reports and their classification. There will be another table tblREPORT_ATTACHMENTS, which will have the following columns: ID, REPORT_ID, MASTER_ATTACHMENT_ID, and ATTACHED_BL (boolean). So, depending on the class of the report, the list of possible attachments may change. I would like the list of possible attachments to be populated on a form, with check boxes next to each one to show whether it was actually attached or not.
I was thinking about a workflow such as once a user selects the class of report, to delete any records in the tblREPORT_ATTACHMENTS with the REPORT_ID equal to the current RECORD_ID, and then fill the form control with the results of SELECTing the records from the master table where CLASS = selected class.
If this workflow makes sense, I could use some help implementing it. Specifically, how do I build the control on the form that will hold the check boxes? If this workflow is not a very smart way to do, can someone suggest a better way? And explain how to do it?
By the way, I did search for this, but I don't really know what this type of thing is called. Makes it pretty hard to search for. If this is a common thing, perhaps someone could just point me in the right direction. In that case, a full answer here would not be necessary.

Parent-Child Database (MS ACCESS)

I'm trying to build a database for a hospital program. I have two tables that are related in a parent-child relationship. I have a form to add new records (records that dont already have a parent record) and I want to build forms that allow me to view all of a parent record's "children" as well as allowing me to edit them. I want this form to allow me to search for a record in such a way that only one parent record can be
returned.
Please see my database at http://rapidshare.com/files/283207434/IC.mdb.html
-check the form called "TEST". I can't get it to work so that the main form controls can act as filters to display the child records in the subform. I have been to many many forums and my lack of knowledge makes forum tag almost useless. A friend told me that this service was fast! If there is someone out there willing to help this poor soul over IM or something, that would be terrific! But I'm willing to work with you here too :) Hope to hear from you soon!!!
-Thanks
Zorkmid
There isn't really any code involved. From what other forums have told me, I don't need any code. Here's what a MS MVP said. I've tried all that, and I cant pinpoint the errior.
Build you main form based on the main (parent) table. DO NOT use a sql join
to bring in child records. Simply build a form on this main table.
To have the form "jump" for move to selected name simply use the combo box
wizard and drop in a combo box (follow the instructions).
Now, create a continues form based on the child table. Again, you can build
this form and base it on the child table. Again, don't use a sql join, nor
try to bring in any fields or parts of the parent table.
It is assumed you also correctly setup the relationship between the two
tables in the relationship window.
Now, bring up your "main" form (the one based on the parent table) in design
mode. Make sure wizard are enabled, and then drop in a sub-form control and
follow the wizard instructions (choose the correct form based on the child
table). Ms-access will setup this for you.
The end result is that if you navigate in the main form, the child form (sub
form) will follow and display the correct child records. and, in place of
using the navigation, if you use the combo box created by the wizard, then
again when the parent form move to a record, the child form will display the
correct records.
All of the above can be done without you having to write one line of code.