Jumat, 05 Juni 2020

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

Russ,

You won't see the "pencil" in design view only in form view.
You added vba code to the After Update property where you should have [Event Procedure] which would open the VBA window. Baldy provided a very good link for new vba programmers. It's something us mature/old developers sadly take for granted.

Please come back if you have more questions.

Duane


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Russ <grizpatch@twc.com>
Sent: Thursday, June 4, 2020 5:53 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Updating a list box after new record entry
 

Crystal,
I do not see any "pencil" that you indicate.  I tried Ctrl-S and that did not do it either.   I put the Me.listbox_list32.requery in the form's AfterUpdate event but that did not get it either.

Please see attached image of my form.



"How can I save the record without closing that form?"

manually, you can click on the record selector box (where the pencil is, indicating there are unsaved changes. If it doesn't show or you want the keyboard shortcut, it is Ctrl-S

To automatically save a record when a particular value is changed, on that control AfterUpdate:

Me.Dirty = False

this is a somewhat obscure way to save a record because it isn't very intuitive, but good to memorize ;)

no need to test if the record is dirty first because the code runs on the AfterUpdate event of a control, so it obviously changed ;)

However, that won't requery a combo box. To do that, you can put this code on the Form AfterUpdate event:

Me.combo_controlname.requery

WHERE

combo_controlname is the NAME property of the combo box (or listbox)

 

kind regards,
crystal

Tidak ada komentar:

Posting Komentar