MS Access Subform field automatically - ms-access

I have a MS Access form and subform, the subform is linked to the Form, while for each project (Form) there is 3 type of visits (Monthly, Quarterly & Annually). What I require that for each project, I want the subform to show the 3 options automatically (in the combo box), and the user should fill the FF Hours and FA Hours Subform

Good day,
You can achieve it by the following steps.
Create a table to store the visits(add three records for monthly, quarterly, and annual). In my own case, i called the table projectvisit.
For the main form, in my example i created a table called site
For the subform, i created a table called sitedetails
Then i created an insert query that will insert 3 records(from the projectvisit table into the visittype field in sitedetails table, for the active main form record)
I create a macro that has 3 actions
A. Open query(run the insert query)
B. Gotonextrecord
C. Goto previousrecord.
Finally i added a command button to the mainform that runs the macro.
Find attached images of the tables, query, form,and macro. You can modify it to meet your needs.
Do take note that before the command button will run the macro, you must have populated the current record of the main form.
Also, go to access options,advanced tab and uncheck action queries.

Related

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 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.

Access: a Form with 2 subforms (Same table)

I am trying to create a Form of Payments, and I want to split the actives and pasives with two subforms.
I have made it, and works! The table Payments store the values.
The actives and pasives are in a table.
ID -> Number
Description -> String
Pasive -> True/false
I have created two Forms, for actives and pasives. Each form displays the corresponding values.
Also I have created main Form that contains two subforms (actives and pasives)
When I insert a Payment
GREAT! It works!
But, when I open again the form, the values are disordered.
Can you help me?
Thanks!
I'm not sure if it understand you correctly. It looks like your subforms don't know which data is passive and which is active. Try this:
Instead of yes/no field in your table, you could rather create field with dropdown list that allows you to pick one of two values: passive or active. Let's name that field: transactionType.
Then you should add transactionType control to each subform.
In the first subform you set default value for transactionType control as a ="active", in the second subform: ="passive".
Now you can set visible parameter of transactionType controls in both subforms to no. In form view you won't see them, but if you create new record, the will add proper information to your table.
Are your subforms based on query? If no, go to subforms data source, create query based on your table and in the criteria of transactionType field set respectively "active" (in the firs subform) and "passive" (in the second one).
When you reopen
your form, thanks to query filter you have set in step 5, subforms will
display only actives or only passives. If you chose that solution, this will work for new data only. If you already have some data in your table, you should manually complete trasactionType for each existing record.

Changing Record of Subform in MS Access

I have a form that contains 4 subforms. The first subform gets data based on a selection in a combo box on the main form. The second subform gets data based on the first subform, and the third and fourth subforms get data based on the first.
It's a database contain information on research grants. I want to be able to pull up certain data based on a person's ID (multiple records to a person) or by the title of the grant. Names are working fine, but searching by title is giving me a hard time.
I've tried setting first subform's Record Source with a .RecordSource ="" line, but nothing updates at all when the code runs (the code is in the AfterUpdate event of the combo box containing grant titles). This one has me sort of stuck; I'm not sure if the dependencies among my forms have something to do with it.
Did you put a Form.Refresh in after you updated the recordsource?

Selecting a record in Access Subform

I have a form in Access 2003 that contains 2 subforms. The first is in datasheet view and is only 2 fields, SiteID and SiteName, so a list of many sites for one record in the parent form. The second subform is the same datasource as the first, but in single form view, so it shows all the site fields for one site in a single form. The idea being that I have a list of the site names on the left and I want to then click on one and have its OnCurrent event filter the subform on the right to show all the fields in that record (for that site).
This seems like a fairly simple thing to do but I can't figure out what code (docmd.gotorecord?, filter?, programatically change the subforms query and then requery etc) is the best to use... and how to make it actually work.
Any help appreciated.
Have a look at the Customer Orders form in the Northwind sample database (NWind.mdb) that ships with every version of Access or can be downloaded http://www.microsoft.com/downloads/details.aspx?familyid=c6661372-8dbe-422b-8676-c632d66c529c&displaylang=en
I think you will find it does what you want.