We help IT Professionals succeed at work.
Get Started

how to close form after inserting new records

kg6lfz asked
Last Modified: 2015-03-25
I have a Form1 that user can input ship_id and ship_date.  Upon the clicking on "OK", those inputs were inserted into Table1.  This works fine.  But the Form1 stays open.  How can I close the Form1 when users click on "OK" and records are inserted at the same time?

Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click

    DoCmd.GoToRecord , , acNewRec

    Exit Sub

   MsgBox Err.Description
   Resume Exit_cmdAddNew_Click

End Sub
Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE