opening a form and entering data isn't adding information to table

I have two forms.

frmAssetsMain
frmAssets

from frmAssetsmain a button is pressed to open frmassets to enter data.  The code on that button is:

Private Sub Btn_NewAsset_Click()
DoCmd.OpenForm "Assets", acNormal, , , acFormAdd
End Sub

Once the information is entered on that form, another button is pressed which is supposed to save the record and update the the subform AllAssetsSubform located on FrmAssetsMain to show the new record which was added.  The code I have on that button is:

Private Sub Command86_Click()
On Error GoTo Err_Command86_Click
DoCmd.Save
Forms!frmAssetsMain.Requery
   
Exit_Command86_Click:
    Exit Sub

Err_Command86_Click:
    MsgBox Err.Description
    Resume Exit_Command86_Click
   
End Sub

Something here isn't working right.  The first button opens up the new form with no problems, and opens it up to add a new record as I wanted, but once that data is entered and the second button is pressed, that information is NOT being saved to the table.  It was working previously when I had just a DoCMD.GoToRecord command on the first button, but then it was always opening up with all the records and displaying the last record in the table instead of opening empty so a new record could just be added.  But once I changed the code to what it is now, it stopped working.  Could someone please tell me the error in my code to make this work?

What it's supposed to do:  Open the frmAssets, enter a record, press a button, save the entry into the table, requery the underlying form to update and show the newly entered information and then go to the next blank record to allow entering of another record.
JARichardHIAsked:
Who is Participating?
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.

ptykwylxCommented:
It's not  DoCMd.Save for saving your record, it is,
DoCmd.RunCommand acCmdSaveRecord
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
JARichardHIAuthor Commented:
Thank you, that fixed the error with it saving to the table, but what about the going to the next open record automatically after hitting the save button?
0
ptykwylxCommented:
If you have an Autonumber field (e.g. ID), maybe you can use a query like this one on the main form,
SELECT tbl.D, tbl.Field2, tbl.Field3
FROM tbl
WHERE (((tbl.ID)=(SELECT Max(tbl.ID) AS MaxOfID FROM [tbl])));
When you requery, you will always have the last one.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ptykwylxCommented:
There's a typing error in my last post, the first line should be,
SELECT tbl.ID, tbl.Field2, tbl.Field3
0
JARichardHIAuthor Commented:
Well, for that second part of my issue, going to the next empty record all I needed was a DoCmd.GoToRecord,,acNewRec.  Thanks for that first part though, you just lost me on the query thing.
0
JARichardHIAuthor Commented:
Thanks for this, helped alot I can stop beating my head now.  The second part was actually rather simple.  All I needed was a DoCmd.GoToRecod,,acNextRec   I really gotta learn this coding.  Little bit at a time though
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.