Kamis, 04 Juni 2020

Re: [MSAccessProfessionals] Updating a list box after new record entry

Hi grizpatch,

I copied and pasted the previous messages in this reply to continue with the context. Please make sure you try this when replying. 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. 

Duane


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of grizpatch@twc.com <grizpatch@twc.com>
Sent: Thursday, June 4, 2020 1:40 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Updating a list box after new record entry
 
You are dealing with someone who is not too familiar with Visual Basic.  Where would I put this vba?
_._,_._,_

Hi grizpatch,

You can requery the list box. I typically use a little vba like:

Me.lboNameOfControl.Requery

Refresh All from the ribbon might also work but I like vba.

Duane


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of grizpatch@twc.com <grizpatch@twc.com>
Sent: Thursday, June 4, 2020 12:57 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: [MSAccessProfessionals] Updating a list box after new record entry
 
When I add a new record to my MSAccess 2010 database on a form with a List Box, the new record does not appear in the list box unless I close the form then re-open it.  Is there a way to have the new record appear in the listbox without going through that?

Tidak ada komentar:

Posting Komentar