create records then auto populate on open

this is the scenario. I have a form based on a tblBudgetHeader called frmDailyHeader. on that form I have info such as date and other daily information that is common for all the divisions that I will be entering. I also have a sub form that has information I need to enter for each individual division of the company. The sub form is linked to the header so for each day there should be a record. The sub form is datasheet. So that the person doing the data entry is entering information for each division I need the sub form to create a new record for each division and populate the sub form when a new daily entry is made. So I will have something open the form frmDailyHeader and I assume that I will put some kind of code in the on open event. But what?
LVL 1
mona4980Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
I would use the On Current event to test for we new record. Then run an append query to all all teh record for the parent record into the child/related table. You would then requery  the sub form control to show the new record read for data entry.
mona4980Author Commented:
So how do I get the new record for all of the divisions?
mona4980Author Commented:
You see I have 6 divisions. When somebody creates a new day I want all 6 divisions to auto populate in the sub form waiting to be updated.  
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
I would assume that you have a divisions look up table.

You would select all the division records from teh at table and  append the division ID  into the related/child table adding the primary key from the parent form so they are linked.

Here is an example that takes all the products and adds then to an order

INSERT INTO [Order Details] ( ProductID, OrderID )
SELECT Products.ProductID, forms!Invoice.OrderID  AS OID
FROM Products;

Open in new window


mona4980Author Commented:
I have a divisions table tblBUDIV the PK is BUDIVID. for the main form I have tblBUDAILYHEADER and the PK is BUDAILYHEADERID. In that table I have BUENTRYID . That links the table for the sub form, tblBUDAILYENTRY, that keeps the information for the individual divisions. tblBUDAILYENTRY PK is BUENTRYID and
mona4980Author Commented:
and BUDIVID. does that help?
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
Maybe something like this in a saved query:

INSERT INTO [tblBUDAILYENTRY] ( BUDIVID,  BUDAILYHEADERID)
SELECT tblBUDIV .BUDIVID, forms!frmDailyHeader.BUENTRYID AS BUENTRYID 
FROM tblBUDIV ;

Open in new window


Is it possible to post a sample database?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mona4980Author Commented:
Thank you for your help. By using that saved query it populated the form.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.