Sync Form to Listbox

Steve R.

Retired
Local time
Today, 14:03
Joined
Jul 5, 2006
Messages
5,439
The code following works, except for an irritating glitch. List7 is a listbox. As you scroll down the listbox, the underlying form displays the record highlighted by List7. I added an optionbox (Frame33) to provide a filtered list.

The glitch is that it takes two clicks on the same option button instead of one to sync the form to the list box. The first click updates the listbox as expected, but the form itself is not updated. The second click, updates the underlying form.

--------------------------------------------------------------------------
Private Sub Frame33_Click()
Rem Problem with the code requires two clicks to work for unknown reason.
Select Case Frame33
Case 0 'show all records
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM projectnumqry; "
Case Else 'show limited (filtered) list
Me![List7].RowSource = "SELECT [projectnum], [projectname] FROM projectnumqry where [type]=[frame33];"
End Select
[Text29] = [List7].ListCount - 1
Me![List7].SetFocus
Me.[List7].Selected(1) = True
End Sub

Private Sub List7_Click()
Rem Syncs form to List7. Pulls-up the summary form information for the selected project.
Me.Recordset.FindFirst "[projectnum] = " & Me.[List7]
Call setcontrols
End Sub
 
I implore you to adopt a more appropriate naming scheme for your controls.


An EVIL DIRTY solution may be to: "Call List7_Click()" at the end of Frame33_Click

That is bad and the purist in me is praying that it doesn't work.
I'm sure someone will be able to give you a good answer.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom