MS Access ADD New Record Help!

I have a form called frmCallTypes with a subform called frmCallTypePrices on the main form i have a  cmd button called cmdAddRec  i want it to on click add on record for the main form and add 3 records for the subform  with values placed in each record that is added below works if i have a cmd button on the subform

Private Sub cmdAddRec_Click()
On Error GoTo Err_cmdAddRec_Click


    DoCmd.GoToRecord , , acNewRec
    Me.StartTime = "12:00:00 AM"
    Me.EndTime = "7:59:59 AM"
    DoCmd.GoToRecord , , acNewRec
    Me.StartTime = "8:00:00 AM"
    Me.EndTime = "4:59:59 PM"
    DoCmd.GoToRecord , , acNewRec
    Me.StartTime = "5:00:00 PM"
    Me.EndTime = "11:59:59 PM"

Exit_cmdAddRec_Click:
    Exit Sub

Err_cmdAddRec_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddRec_Click
    
End Sub

Open in new window


but again i dont want a button on the subform i want it on the main form, and it needs to add on blank record for the main form and the listed above for the subform. thank you
Blueice13085Asked:
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.

Blueice13085Author Commented:
ah well i figured it out and thanks for the help everyone!

Private Sub cmdNewRec_Click()
DoCmd.GoToRecord , , acNewRec
Me![CallTypePrice].Value = "0"
DoCmd.RunCommand acCmdSaveRecord
'sets the focus on the subform
Me![frmCallTypePrices].SetFocus
DoCmd.GoToRecord , , acNewRec
Me![frmCallTypePrices].Form![StartTime].Value = "12:00:00 AM"
Me![frmCallTypePrices].Form![EndTime].Value = "7:59:59 AM"
Me![frmCallTypePrices].SetFocus
DoCmd.GoToRecord , , acNewRec
Me![frmCallTypePrices].Form![StartTime].Value = "8:00:00 AM"
Me![frmCallTypePrices].Form![EndTime].Value = "4:59:59 PM"
Me![frmCallTypePrices].SetFocus
DoCmd.GoToRecord , , acNewRec
Me![frmCallTypePrices].Form![StartTime].Value = "5:00:00 PM"
Me![frmCallTypePrices].Form![EndTime].Value = "11:59:59 PM"

End Sub

Open in new window

0

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
Blueice13085Author Commented:
I answered my own queston
0
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.