Kamis, 04 Juni 2020

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

Hi Russ, 

VBA code goes here:

http://baldyweb.com/FirstVBA.htm


Paul
Sent via mobile device


-------- Original message --------
From: Russ <grizpatch@twc.com>
Date: 6/4/20 5:25 PM (GMT-07:00)
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Updating a list box after new record entry

Crystal,
I have tried your solutions but I could not get them to work.  Please view the attached image of my form and see if I have done it correctly.  Oddly, I have sent this message 2 times before but it has not appeared in the Messages list.

 "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