That code goes to a new record but the record is not saved until you leave the record by closing the form, moving to a different record, or performing an action that saves the record.
Duane
From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Russ <grizpatch@twc.com>
Sent: Thursday, June 4, 2020 2:13 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Updating a list box after new record entry
Sent: Thursday, June 4, 2020 2:13 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Updating a list box after new record entry
I have a button that says Add Record which runs an event procedure like this
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
DoCmd.GoToRecord , , acNewRec
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click
There is maybe a control that says something like "include.."
Set the property to [Event Procedure] and go to the VBA code like
Private Sub Command4_Click()
Me.lboNameOfListBox.Requery
End Sub How do you add the new record and is it on the same form? You can add a button on your form and find the event properties in the form design.
Tidak ada komentar:
Posting Komentar