Entering data once for multiple records - ms-access

One main purpose of a database is to make user entry concise - enter data once and reuse/display that data in different places without requiring the user to enter it again.
In my database, I sometimes have identical data I need to enter in many records, for example, ages of employees. Perhaps I know that 10 employees I just hired are all age 25. Instead of entering 25 once for all employees, I'm looking for a way to enter the number 25 once, and let me select all employees I want to apply the data to. That way, click once to open the form, I type 2 characters, and click 10 times to select 10 employees, and then click once to close (total 12 clicks 2 characters typed) as opposed to clicking to open a form 10 times, typing 2 characters 10 times, and closing the form 10 times (total 20 clicks, 20 characters typed)
Basically, using an access form, how can I type one value, or select one combo box item, and apply it to multiple records with the same column name?

In principle: Your employees table has a Yes/no field. You create a continuous form showing their ID, names and the Yes/no field. You click yes for all employees. The yes/no:True is a parameter in an update query.
The update query has the employee ID, the yes/no where True and another field that you want to update. Each time you to want to run the procedure you amend the query as required in the 'other' field, close it, open the form, make your selections as to who is to be updated and run the query, probably by a command button. As it's an action query I would also include in the command button some sort of warning via MsgBox.

You can copy and paste the value with Ctrl+C and Ctrl+V. That will make 1 + 25 keystrokes = 26 keystrokes.
No programming will beat that.
While the users have fun with this, you can concentrate on core stuff of the application.

Related

ACCESS 2010 VBA

I have a table tblSupplierCriteria. I can populate it from a form that consists of the Supplier Name followed by a dropdown box that lists 46 criteria.
The user selects one of the criteria and then clicks on save. In the table, the saved record looks like - Supplier1 nuts, the next record looks like Supplier1 bolts and so on.
Each Supplier can have between 1 and 46 records. Each is added one at a time. The form works fine but it is tedious. Is there a way that I can display all 46 items at one time and let the user choose by clicking a check box or something and then populate the SupplierCriteria table as described above?
This is part of a highly integrated application and I cannot modify any of the table structures.
In general, if you can display the criteria in a dropdown box, you can display them all in a pop-up form so someone can tick them off.
If you can create a local table, you can copy the 46 criteria from the central data to the local table, and add a Yes/No column so you can record what the user picks.
Base your pop-up form off of the local table. Populate SupplierCriteria based on their choices.

Use an Access 2010 form based on 1 table to enter data in a linked table

First of all, I am a total NOOB! I am trying to make an Access DB for handling orders through an entire process. As such, I have created tables based on each of the individual processes. The order data, which holds only the basic information is in tblCurrentOrders. Each of the other processes is linked to tblCurrentOrders by the OrderNumber field. The first step of the process is due date information is entered in the tblPlanner table. Obviously, until data is entered in tblPlanner, no OrderNumber exists (this will hold true for the other tables, too, if I ever get that far).
I want to create a form based tblCurrentOrders that shows only the records without corresponding entries in tblPlanner (new orders) and then I want to be able to enter the tblPlanner info in a subform. I have tried making a form based on tblCurrentOrders with a subform based on tblPlanner, but I can't figure out how to only display new orders. I also tried basing the form on a query that only showed new orders, but I don't know how to make the subform based on tblPlanner to work.
Please Help!!
Well, the easiest way to link the tables would be to create your OrderNumber in the tblPlanner when you start a new order. Then add a flag and timestamp as to whether it's "released" yet.
EDIT
Since you provide a little bit more detail, I'll edit my response to more closely align for your desired approach.
Creating a "New Order" is a multi-step process. So it's usually best to create a Command Button on a form that calls VBA code. This will allow you to control each step and make sure it's correct.
Step A: First you want to:
1) Create a Control Form (if you haven't already) that allows you to put Command Buttons which will launch different VBA code or open different display Forms.
2) On the Control Form, create a List Box that allows you to select an existing OrderNumber.
3) On the Control Form, create a Command Button to open an Order Form which uses the selected List Box OrderNumber. When that Order Form opens, it will populate with the tblCurrentOrders data for that OrderNumber and also populate the subform with tblPlanner data. (As long as you have them linked properly.)
4) On the Control Form, create a Command Button to open the Order Form with a set of records which are "New Orders" only. See the more detailed process below in Step C.
5) On the Control Form, create a Command Button to Launch VBA code that will create a "New Order". This is a multi step process detailed below in Step B.
6) Create any other buttons or controls that allow you to monitor or advance your "Order" along the way to completion. (This is a ton of work to get all the pieces in place.)
Step B: When you press the Command Button to create a "New Order" you want to create VBA code that will:
1) Create a new record in the tblCurrentOrders table.
2) Create a Unique OrderNumber on the new Record. It's usually best if you control the generation of this number and don't just let it be a system generated sequence number. But whatever you desire is ok as long as it's Unique.
3) Set your ReleasedFlag to false on the new tblCurrentOrders record.
4) Make sure your ReleasedTimeStamp is null. (Or whatever value you want it to be.)
5) You may want a CreatedTimeStamp which you can populate with a date of Now().
6) Populate any other "Initalization" fields that need to be filled. (Like Backorder status, Return flags, Shorted Flags, etc. etc. etc.)
7) Create a new record in the tblPlanner table.
8) Copy the Unique OrderNumber that you created for the tblCurrentOrders record into the OrderNumber field on the new tblPlanner record. This creates a link for you to use with your subqueries and subforms.
9) Now you can open the Order Form with this new OrderNumber.
Step C: When you press the Command Button to open a set of records which are "New Orders" only:
The Command Button needs to launch a query to find "...tblCurrentOrders that shows only the records without corresponding entries in tblPlanner (new orders)":
You just need to select tblCurrentOrders that have a ReleasedFlag set to false.
`SELECT * FROM tblCurrentOrders WHERE ReleasedFlag = false`
So when you say: "...and then I want to be able to enter the tblPlanner info in a subform"... you can create a subform linking to tblPlanner based on the tblCurrentOrders OrderNumber field.
This is all reliant on you observing that when you say "...records without corresponding entries in tblPlanner..." That you really mean: records without released entries in tblPlanner. And that means: in order for a record to exist in tblCurrentOrders, it has to have a corresponding blank (or starter) record created in tblPlanner. Thus now you can display blank tblPlanner records that are linked to unreleased tblCurrentOrders records.
Then once your data entry people are done monkeying around with the New Order, they can "Release" the order (usually by clicking on a Release Command Button). At that point, you can set your ReleasedTimeStamp to Now() and set your ReleasedFlag to True in the tblCurrentOrders. It's officially no longer a "new order" and is now a live order in your system.
You are at the tip of the iceberg for creating a home grown order entry system. The complexities for building a good one are immense. Best of luck figuring it all out. Just remember to use time stamps and ID fields so you can go back and un-do what may have been done by accident.
Hope this all helps. :)

Display specific records depending on user's choice

I have a MS 2010 Access Report that needs to be populated by records that a user pre-chooses. For example.
Form1 has 2 fields, LOT# (which is record id) and CheckoffBox (unbound).
User checks which Lot#'s (records) he wants displayed, then clicks REPORT button. Report only shows selected records.
Can someone help me create the code?
In order to allow the user to use a check box to select multiple records, the list presented in form 1 must be based on a table that has LOT# and a yes/no field. (ie form 1 must be based on a query or a table that ahs this yes/no field).
If only one user will ever use this at any one time then you can simply add a yes/No field to the table that has all the LOT# values.
On your report you then only print those lot numbers that are checked.
Your report simply has to have SQL with a where clause that only print records that have the Yes/No field ticked. (=true =-1).
If many users are going to use this form at the same time it gets more complicated as obviously they all need to have their own "set of yes/no fields".
So you would need to copy the table with the LOT# into a temp table for use by each user (it might have a primary key of USERID, LOT#, or it might be a table with just LOT# and yes/no fields, that only a user can access - ie in their own copy of the database file that has the front end forms).
Anyway, assuming it's a single user, creating the above should be quite straight forwards.
On opening form 1, you might use the form_open event to run a SQL statement that sets all the Yes/No values to No. Although you might not want to do this.
Use
docmd.SetWarnings false
Docmd.runsql "UPDATE theTable SET YesnoField = 0 WHERE YesnoField = -1;"
docmd.SetWarnings true
Let me know if you can take it from here.

Refresh MS Access Form/Query Based On Combobox Value

Pretty simple explanation. I have a table with 10 entries, 5 entries with the year 2010 and 5 entries with 2011 in a column.
In the query I have, I use Like *2010 to filter out all entries equal 2010 and display onl those records.
On my form, I have combobox being populated with each unique year (from a different table). So my combobox values are 2010 and 2011.
Is it possible, when I select say 2011, I trim the right 4 characters and use as my Like criteria to refresh and requery the form, all done within VBA?
You can refer to the value of a control in a query run from within an Access session, as long as the form which contains that control is open.
SELECT *
FROM YourTable
WHERE date_field_as_text Like "*" & Forms!YourForm!YourCombo;
So perhaps you can use a similar query as your form's record source, and do Me.Requery in the combo box's after update event.
If that's not close enough to what you want, please give us more information about the data types of the fields involved. Adding brief samples of the table data to your question could also help; please make it clear whether the "date" fields are text or Date/Time.
Yes, it's possible.Just add your stuff to the 'YourComboName.After_Update'.
Look for the Events of the Form that are fired before the form is shown. There build your query as like HansUp suggested.

Drilldown using unbound comboboxes with Access "Continuous Form"

There has got to be a simple(r) way to do this.
I have a situation where I am listing parts using continuous forms. The parts listing has things like the part type, manufacturer, part number and the quantity. The list is of the part instances & quantity. I can look the other things up from the instance of the part, so displaying existing parts is no problem, just use a joined query to retrieve the related records or using a DLookup to pull the fields individually.
Type Manufacturer Number Qty
-------------------------------------
Widget Acme 123ab 1
Widget Acme 456 1
Anvil Xyz 12345 2
Llama Northwind 322-12A 1
...
The problem is where the users need to add new parts. There are thousands of different parts, so they can't really choose from a single part number combobox. They want to be able select a part type, manufacturer, and then the part number from three different comboboxes that successively narrow the results in each combobox.
Select a part type >> select a manufacturer who makes one of those types >> select part number of parts of that type by that manufacturer >> enter quantity
Ok, so I can use 2 unbound comboboxes with a DLookup as default, and link them via their Row Source queries. The final combobox is part number with its Row Source filtered - so it only lists the parts from selected type and manufacturer. I have done that before with this kind of situation and it works well.
However I am trying to do this with continuous forms in Access and it is returning the same result for the Dlookup on each record. E.g.
Type Manufacturer Number Qty
-------------------------------------
Widget Acme 123ab 1
Widget Acme 456 1
Widget Acme 12345 2
Widget Acme 322-12A 1
...
Argh, what's going on? My Dlookups seem to be only using the value from the first record. Why?
Is this even a good way to do this? Is there a better pattern to use than drill-down comboboxes on the continuous form? The only other way I can think of to get around this is to use the comboboxes on a "add/edit part" type form where the details are selected in a dialog and then the part number is populated from that. But that seems even more kludgy.
Using unbound controls on a continuous form will only drive you demented, because an unbound control can only refer to the selected record, which could be any of them. I think the pop-up form for adding new records would be quite nice, and easy for the user to understand.