Save multiple rows from single Access form where only two field values change - ms-access

I feel this question has been asked a million times but i can't seem to find what i need from the answers.
My wife has an audit spreadsheet (see image) that she would like made in to a database. I am relatively new to Access, but not to databases, so i know what i want but am struggling to get it.
In the image, you can see the 4 columns in the top left. "Date" would be from a date picker, "Area", "Auditor" and "Shift Leader" would be from a drop down list.
Each field under each category is fixed, so i can present the title of each field using a list box that pulls the relevant title name from a table.
All titles needs to have a score and comment assigned and then all of this information needs to be committed to the "tblAuditItems" table in individual rows, with each row having the "Date", "Area", "Auditor" and "Shift Leader" added.
What i feel i need to do, is to have all titles set when the form loads, my wife would then fill in the "Date" field along with the other 3 and then click a button to commit all of this data to the table. A kind of "Add records" or "Generate records" button, with a loop to run through each title.
She would then go through the form, adding the information to the "Score" and "Comments" boxes and click "Save records" at the end.
UPDATE: -- As far as table structure goes, all of the titles are held in a table called "tblCodes" along with other things. In that table, there is the OID, the title text and a 'codeset' that will allow me to group them when reporting.
The date, score and comments are fields of their own in tblAuditItems, the auditor names are stored in a tblAuditors table and are looked up by the Auditor field in tblAuditItems.
Essentially, i dont want the tblAuditItems to hold any text other than 'Comments'. I find it far easier for building dynamic reports. -- :UPDATE
Can anyone offer any advice on how to best achieve this?
Thanks in advance, i have until tomorrow..... :(

Related

Issue w/ Cascading Combo Boxes deleting field values from records they pull from for Form

My apologies if this question has been answered before but I've searched all day today and haven't been able to find the answer I seek. I'm building a database for requesters to submit requests to order paint using combo boxes that pull from a PaintCatalog table, broken down by ProductName, ProductColor, Nomenclature, UI, StockNumber, DuplFieldCd (I use this a unique key for paints with the same product name but come in multiple colors and Units of Issue.) I've been trying to set up a form to pull the data into cascading combo boxes from this PaintCatalog, with each selection reducing the dropdown choices until it reaches only 1 choice, at which point it autofills specific fields. Then the user clicks a command button and the values in the form fields are used to create a new record in the PaintRequests table. I've got most of that to work, however when I delete values from form's combo box fields when I'm retesting the form, one of the records in the PaintCatalog starts to get blank values. I need this issue fixed before I can progress any further. I've tried using a query instead of referencing the table directly, but the data is still getting edit, deleted, or overwritten. I'm getting that pencil icon every time I'm using one of the form combo box fields. Please advise.

How to get combo box selection to fill related fields with data

I have a table [inventory] with inventory items, and a bunch of columns with different information for those. Mainly, part#, description, price. I am trying to create both a purchase order form [POForm] and, and a inventory transactions form [TransactionsForm], but that one thing I've been stuck on is getting a combo box look up I use to select the part# from [inventory], to also fill my fields for description, and price for that item in my form. I need the fields that are filled to be able to have formula's run off of them, and the information to be saved into the table for that form [TransactionsTable], [POTable].
I've tried making my part# combo box include the fields for the description and price, and using =[part#].[column](x) in the other fields as a lookup, and it looks right visually, but that is apparently just a visual of that data, but technically the field is still blank, because those other fields remain empty in the table for that form, and I am not able to run a formula off the price.
As per my understanding and please correct me if I am wrong. you have a form that shows your inventory data Part# Description & price. This form has a combo box that allows you to select a particular part # to view its related record data description and price.
Now you want to click a command button after selecting a particular part # to update your transaction form and POtable.
1.you have to create a query,
2.insert the inventory table in it
3.select append from the query type in the ms access ribbon
4.a window will appear, choose the transaction table as the destination table to append to.
5.double click on the fields that you want to retrieve its data from the inventory table
6.then in the table below in the query itself in the "append to" row you will find drop-down menu including all the fields from the transaction table. choose the corresponding fields. note if the fields have the same name in both tables access will do it automatically.
7.in the criteria row type the following [Forms]![Inventory Form Name]![the name of the field in the form]. do that for each field in the happen query.
8.save the query and name it
9.go-to design view in your inventory form and create a command button, in the click on event creat macro of the following: openquery-->type the append query name
10.save and close macro builder
11.open your form, select part#, click on the button
12.access will ask you to confirm appending process. click ok/yes
13.check your transaction table to confirm that the append process was successfully performed
14.Tip if you do not want the confirmation msg of append to appear, in the click on event go to the macro builder and choose in the ribbon show all actions then in the first line of the macro builder insert setwarnings - NO
the same is to be applied for the POtable.
Anyways, I hope you find this clear and helpful but I have only one concern you do not have to append part description and price in transaction and PO tables as you already have this data in your database in the inventory table. Generally speaking no need to include the same information in multiple tables otherwise you are not benefitting from the idea of a relational database.
I hope I addressed your inquiry.

Access VBA To Populate a Table Based on Form Selections

Question for you.
I have a table (let's call it "table 1"), with about 40 different fields in it. I also have a table 2, in which there are three fields: ID, FROM, and TO. (There will be a form front-end attached to this table.) The "FROM" field will have every field from table 1 listed in its 40 cells.
In a perfect world, users will be able to go into that form, and use drop-downs in the "TO" column to select which fields they want populated in a third table, based on the corresponding "FROM" cell next to it.
For example: The user will see "First Name" in the "FROM" column, and decide that he wants to pull that data. So he will use the drop-down in the "TO" next to it, and select "field1". It will then be placed in a third table, in the first column. Then the user looks down a few rows, and sees "SSN" in the "FROM" column. He will want that, so he picks "field2" in the "TO" drop down.
My question is: is this doable? To selectively populate a table, from the data in another table, based on selections made?
Sorry if this wasn't crystal-clear. Let me know if I need to explain anything else.

How do I show only the available options in a combo box on an Access form?

I'm making a reservation system on Access 2010 and I have a form that reserves a table for a customer. I just input the customer's Customer ID, date and time of reservation, and the table.
Originally, my form's layout is like this:
However my professor said it wasn't efficient because you'd have to check the database just to see if the table is still available. He suggested a dropdown list of the available tables left for reservation. Also, the tables have a format of D-# or L-# depending whether it's for lunch or for dinner.
I know how to put the dropdown list and stuff but I'm not sure if I know how to update it.
My table (database) for the reservation is just the list of the reservations made on that day.
I hope someone can understand my idea.
Take a look at the Microsoft help article here:
Basing one combo box on another
In your case the values in the combo box (for the table numbers) would be based on the current value of a text box (for the date), but the principle is the same:
The Row Source for your combo box is a query that filters the list of tables based on their availability on the date specified by the .Value of the "Date" text box. In the After Update event for the "Date" text box you tell the combo box to .Requery so it will list the available tables on the date in question.

Can I make one form to get record data from multiple (unrelated) tables in Access?

I know only the basics of Access, so I am having trouble figuring out how to make a form that will access multiple unrelated tables.
My problem:
I have several tables which describe different card collections. There is no way that I want to link them, even if I could, e.g. by card names. This is because I want to keep the listings separate. I do, however, want to create one form that will access them all, so that I don't need to fiddle about clicking on different forms every time I want to update a card database. The more tables I include, the less practical this would get, anyway. I've tried looking this up and there are several sites which seem to suggest sql-like statements as solutions, but frankly these fly over my head - I don't even know where I'd write them!
So what I want is one form that has a combo box menu to select the table that I want to edit, then another box to select the card that I want to see and hey presto I can edit the details of that card. I can do this if I make one form for one table, but I don't know how to do it for many tables. I would also like it to check for new tables should I add them in. E.g. cards have different series that come out, so when a new one comes out I will create a new table for it, add the cards and so on...
I realise this is probably quite fiddly, especially in Access, but if anyone can give me some guidelines on how to do this it would be much appreciated. (I'm using Access 2007)
To answer your question:
Use subforms. Create few subforms and your combobox and hide/show the forms as you desire.
Better way to do it:
Creating separate tables for each card type is quite a bad practice. If the cards share features like MonsterName, MonsterPowerType or whatever, you should create another table like card_types and add a card_type field to the cards table. Then if you need to get only Pokemon cards create query with card_type_id = xx or card_type_name = "Pokemon" criterias.
This way you only need one form and you can change the card_type criteria with use of your combobox.
This is quite old, but it might help others. I did figure a way to do exactly what you asked
I only have access 2016, so things might be in a different place, but not that much.
First, create all the tables for each of your decks. Make sure you have in the first column : unique ID, second column the name of the deck (it's going to be the same for each entry in this deck) this is going to help us. The third column the name of the card. The other columns will contain your other values of your card, but for my example it doesn't matter.
I'll name them like this
column name
1 unique_ID
2 DeckName
3 CardName
Now, in the tab "create" choose "Query Design". Then in the tab "home" in the seciton Views, choose SQL.
in the blanck section enter this
I have 2 tables :
Table1 and Table2
SELECT Table1.DeckName FROM Table1 UNION SELECT
Table2.DeckName FROM Table2;
You have to add each table and add a UNION between each. You finish the sentence with one semi coma only ;
Click run and you should get all the DeckName.
Save your query and close it.
Now, we want the combobox to help us choose between the different decks.
in the tab "Create" choose "Blank Form". Go to "home/views" choose "design". In the "design" tab, choose the combobox. You can click cancel and skip the wizard
In the property, click "rowsource" and select the query you have created.
Name it Cmb_Deck
Add a second combobox
Name it Cmb_Name . property "Column Count" put "2" because this combobox will show the name of the card, which is column2 in our tables.To be a little bit fancy, we will hide the first column, in the property "Column Widths" put "0";1"" (first column 0inch, second column 1inch).
Drag any of the table you have create into the form and click cancel when the wizard appear.
Name it TableResult
Now that the layout is created, we need to change the table according to the combobox Cmb_Deck.
In the Cmb_Deck property go in the event section and choose "After Update" click on the "..." and choose Code Builder
In this Visual Basic editor window : delete everything that is there and enter this
Option Compare Database
Private Sub Cmb_Deck_AfterUpdate()
TableResult.SourceObject = "Table." & Cmb_Deck.Value
Cmb_Name.RowSource = "Table." & Cmb_Deck.Value
End Sub
Private Sub Cmb_Name_AfterUpdate()
Me.TableResult.Form.Filter = "([" & Cmb_Deck.Value & "]." & "[CardName]=""" & Cmb_Name.text & """)"
Me.TableResult.Form.FilterOn = True
End Sub
Now back in access, select your combobox Cmb_Name and go into property event/afterupdate and choose "[Event Procedure]
Now in your form, go to home/views and choose Form Views. First choose a deck in the first combobox, then choose the name of a card in the second combobox. Now the table underneath, shows only the card that you want to see.
I hope this helps
-Mathieu Paquin