• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Ms Access Forms Go To New Record after confirmation form runs

Hello,

I have two forms, frmGrindScrap and frmGrindScrapConfirm.  When the command button cmdUpdateLbs is clicked on frmGrindScrap the frmGrindScrapConfirm form opens.

When the user confirms the data it runs an update query to update the information for that record.  After this query runs I would like to set the first form (frmGrindScrap) to a new record. so that the user does not have to click the "New Record" command button.

I figure the code would go right after the DoCmd.Close that closes the confirmation form, I just can't figure out what it should be.

Thanks for your help in advance and have a great day!
Jeff
   screenshot of main and confirmation form.
Private Sub cmdUpdateRegrind_Click()
On Error GoTo Err_cmdUpdateRegrind_Click

DoCmd.SetWarnings False

    Dim stDocName As String

    stDocName = "qryUpdateRegrindOther"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    
DoCmd.SetWarnings True

DoCmd.Close

Exit_cmdUpdateRegrind_Click:
    Exit Sub

Err_cmdUpdateRegrind_Click:
    MsgBox Err.Description
    Resume Exit_cmdUpdateRegrind_Click

End Sub

Open in new window

0
jeff-h
Asked:
jeff-h
  • 3
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:

add these codes after running the query

forms!frmGrindScrap.setfocus
docmd.gotorecord,, acnewrec
0
 
jeff-hAuthor Commented:
Thanks capricorn1!  It seems there's still an issue.  Do you think it's because the form is on a tab control?
0
 
Rey Obrero (Capricorn1)Commented:
is "frmGrindScrap" a subform ?

can you upload a .MDB copy of the app..
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
jeff-hAuthor Commented:
The main form is frmGrind, then there is a tab control (TabCtl0) with two tabs.  The subforms are unbound to the main form. To read a text box off of the form the code works out like this:

=Forms!frmGrind!frmGrindScrap.Form!GroundAs

It's a huge mdb with a SQL backend.  If you think it will help I could upload both.

Thanks
0
 
Rey Obrero (Capricorn1)Commented:
ok, use this then

Forms!frmGrind!frmGrindScrap.setfocus
docmd.gotorecord,, acnewrec
0
 
jeff-hAuthor Commented:
Excellent, thanks a million!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now