Solved Listbox selection does not update form (1 Viewer)

ClaraBarton

Registered User.
Local time
Today, 01:33
Joined
Oct 14, 2019
Messages
463
I have a listbox with a FAYT select combo. When a record is chosen in the listbox from the combo, I'd like another subform to update from that selection. I've tried to requery the form but the subform will not update untill I actually click on the list box record. Is there something I'm missing here?
Code:
Private Sub cboSearch_AfterUpdate()
   Dim lngID As Long
    lngID = Nz(Me.cboSearch)
   
    If cboSearch > 0 Then
        Me!lstEditList.Value = lngID
        Me!lstEditList.SetFocus
'        Me!lstEditList.Selected(lngID) = True
'        Me.Requery
    End If
   
    Me.cboSearch = Null
    Me.cboSearch.Requery
           
End Sub
 

LarryE

Active member
Local time
Today, 01:33
Joined
Aug 18, 2021
Messages
591
How can you expect the subform to update based upon a selection if you haven't selected anything in the combobox yet? ACCESS is good but it's not clairvoyant.
 

bastanu

AWF VIP
Local time
Today, 01:33
Joined
Apr 13, 2010
Messages
1,402
You don't seem to requery the subform after you pass the value to the listbox (Me.sfrmYourSubform.Form.Requery).

Cheers,
 

ClaraBarton

Registered User.
Local time
Today, 01:33
Joined
Oct 14, 2019
Messages
463
Open List Maintenance from the opening menu.
It's been selected from the combo. It's highlighted. I want to update the form from that highlighted record without clicking on it.
 

Attachments

  • Zip.zip
    4.5 MB · Views: 75

bastanu

AWF VIP
Local time
Today, 01:33
Joined
Apr 13, 2010
Messages
1,402
Please see updated file with code comments.
Cheers,
 

Attachments

  • SampleVlad.zip
    4.4 MB · Views: 93

Users who are viewing this thread

Top Bottom