Set ListBox default to last choosen

samjesse

Registered User.
Local time
Yesterday, 21:08
Joined
Feb 13, 2009
Messages
64
Hi

Thanks in advance for your help.

I have a form to enter record in its underlying table. One of the table fields is a listbox. I would like "less mouse clicking" the form to remember the last item chosen in the list box so that when I move to a new records I do not have to select it from that listbox again unless I want to.

Regards
 
In the After Update event for your listbox, set the default value:

Me.List1.Defaultvalue = Me.List1

I'm assuming this is a bound control. Then, when the new record is created it will store that value.
 
I'm assuming that the Listbox is Bound, as well; if it were Unbound, it would already be exhibiting the behavior you're looking for!

billmeye has the right idea, but the syntax needs to be a little different:

Code:
Private Sub List1_AfterUpdate()
  Me.List1.DefaultValue = """" & Me.List1 & """"
End Sub

Also note that this syntax works for Fields defined as Text, Numbers, Dates and Booleans.

Linq ;0)>
 
Thanks for the correction, in my haste I neglected the quotation marks.
 

Users who are viewing this thread

Back
Top Bottom