Access 2013 retrieving data from textboxes on a form and inserting them into a new table based on the click on a command button - ms-access

Im looking for some help in creating a form than when data is entered into text boxes by the user and then submitted by the click of a command button populates a table as a new record.
My table im looking to put the data in is UserData and the textboxes I plan on using are txtManHours2 , txtAMTs2, txtDuration2, and txtToolsRequired2. I do not have these textboxes bound they are all unbounded. Should I bound them to the table?
Thank You!

I'm not quite sure what you are going for, but if I understand correctly you want to verify the information is correct and make an entry in another table with any changes.
I think the best way would be to create your table UserData with columns:
RelatedID (Number), ManHours2 , AMTs2, Duration2, ToolsRequired2
Then create a query that contains the original fields ie (ManHours AMTs Duration adn ToolsRequired) and the fields from the new table.
You will then add a relationship between the two tables by connecting the Primary Key (ID) from the original table and drag it to the (RelatedID) from the new table
It will be a LEFT join ie ALL of the original table and only the UserData table entires that match. *VERY IMPORTANT
Then make a form based on the query and delete the RelatedID from the FORM only. Now you will have a form that will automatically create a new record and link it to the original. Just make sure to disable to fields that are linked to the original table so the values in the original table cannot be changed.
Let me know if you have any questions about this.
Thank you,

Related

How to prevent a form in Access from deleting data from other tables used to filter in the data source query

I am new to MS Access and VBA coding, and what I know I had to teach myself through video tutorials and reading up on the web. I have an input Form which which gets its data from a query. The query itself gets its information from a table and another query. The reason is that the other query is what filters the data so that the current user can only see his/ her own records, and not that of others. It has been designed in such a way that if a subordinate changes from supervisor, one merely have to update the supervisor name, and all the prior data in the table for that subordinate will also then reflect for the new supervisor, and no longer the old supervisor.
The problem is that the delete button on the input Form (which was created with the button wizard) not only delete the record from the table, but also from the table used to filter the subordinates. I only want it to delete the record from the actual table used in the data source query.
How would I go about to stop it from deleting in both tables?
I have attached a snapshot of a portion of the data source query, just so that you can understand what is meant by the above. The delete button on the input Form deletes the data from the table named "TableReviewNotes" and "TableAuditorNames". It should only delete the record from "TableReviewNotes".
Thanks in advance.

MS Access Form: entering new info into two linked tables without the keys

I have 2 tables, say Employees (employeeID, employeeName, locationID) and Locations (locationID, locationName). What is the most efficient way to view existing records and also add new ones while not typing foreign keys?
For instance, if i create a query on a join between the two, I can insert a new record, but I need to type a locationID. Is there a way for me to have a drop-down box with locationName values instead? I know I can do it in a code, but would be nice to do it via Query or Form without coding.
Create a basic form with your Employees table as a Record Source.
Add a text box for your EmployeeID and EmployeeName.
Add a combo box for your LocationID. When you add the combo box it should start a wizard up - tell it you want the info from the Locations table and hide the key field.
Open your form and start entering data.

Filling up a Form to update data table

I have to create a user-friendly form that allows employees to add details regarding a new shop branch to a data table, also in Access. Using only Microsoft Access, a user has to fill up a form with the relevant details so that a new entry will be appended to a data table.
E.g. A new shop branch will have the fields ShopID, ShopName, and PersonInCharge. Upon filling up a form with these 3 details, a user will click a button "Submit". Doing so will create a new entry in a data table.
I have tried linking the button to run a query that updates the data table but no new entries are created. I have also tried using the "Append" function as part of Query Design, but running it would append "0" rows.
Unfortunately I can't take any screenshots since I'm doing this in a company as part of my internship. This is my first time using Microsoft Access. Would appreciate the help!
In my understanding, you just want to make a simple form that simply add a record into your table right?
why don't you create a desired table first then create wizard form on it. It will automatically generate a form as needed then you can add a button using wizard choose categories -> record operations -> add new record.
Hope it helps!

How to edit an existing record and not create a new one when using subforms in Access?

I have an access database that holds medical information. It holds quite a bit of information so i have grouped like fields together into individual tables and linked them using a common primary key. I have created a tab style form with subforms on each tab.
Some of these subforms contain fields from only one table, however there are a few subforms where i have included fields from more than one table.
For example, i have a table that holds blood transfusion data and a table that holds patient characteristics. Some Fields from the blood transfusion table and patient characteristics table are in the same subform, but I also have fields from both these tables in other subforms.
When i try to insert data into the sub-forms with fields from multiple tables i get the following errors..
update or cancelupdate without addnew or edit
and
The changes you requested to the table were not successful because
they would create duplicate values in the index, primary key or
relationship. Change the data in the field or fields that contain
duplicate data, remove the index, or redefine the index to permit
duplicate entries and try again.
From researching the problem i gather this is because access is trying to create a new record for both tables, but if a record has already been created with that primary key (from inserting data into a previous subform) it won't edit the existing record.
Does anyone know how to get access to edit the existing record in this instance instead of trying to add a new record? I have basic skills in VBA but this is a bit past my level of experience.
Any suggestions would be greatly appreciated.
I used have a whole long response about split forms instead but I was having a horrible time getting it to work. So here is my new and improved answer for using subforms.
Here is a link with sub form info if you want to brush up for your purposes https://support.office.com/en-us/article/Create-a-form-that-contains-a-subform-a-one-to-many-form-ddf3822f-8aba-49cb-831a-1e74d6f5f06b
Step 1
Make sure your main form is bound to the right table.
For my purposes I used a single combo box on my main form to search with. Make sure all the field parameters on your combo box are correct. This includes making sure the Row Source is correct and that you DO NOT have a control source entered.
Step 2
Don't press enter after making a selection in the combo box. To prevent people from hitting enter I created a dummy button at the bottom that says "Save and Refresh" but all it does it create a message window that pops up with "Save Successful". I find hitting enter creates the first error you keep getting. I'm not sure how to address this in a more sophisticated way yet.
Anything else that comes up I will add later.

Want to auto create a table in Microsoft Access dependent on a field in another table

I have a list of landowners in an area with initial information. There is a field that can be checked in the table if the landowner has been contacted. For all those that have been contacted I would like them to appear in a new table. This table would drop some of the information from the original, as it is no longer necessary, and would add some new fields that would then need to be filled in. Is there a simple way to do this? Thanks.
Go into the create Query tool, choose LandOwner table, choose the fields you want to appear in the new table. In the type of query click on "Create Table".
Type in the name of the new table in the wizard, then accept.
For each of the new fields of the new table create an expression in query design:
Lastly add the criteria to only transfer records that have been "contacted". The tick is to decide whether the contact field will also be transfered or not.