P
Patti
I have a listbox that displays a list of clients (LB1). I have
another listbox (LB2) that displays a list of phone calls made to the
client selected in LB1. I want to auto-select the first row in LB2
after the user selects a client in LB1. I can get all this to work
just fine. The problem is that when I click LB2, the LB1_AfterUpdate
is triggered. HUH??? I have verified that this is really happening
by putting in debug.print "proc_name" into my procedures. When the
user selects a client in LB1, the following code snippet is run, which
populates LB2 and selects the first row:
strSQL = "SQL statement here"
Me.lstCallLog.RowSource = strSQL
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
If lngCallID = 0 Then
Me.lstCallLog.Selected(0) = True 'Problem code
lngCallID = Me.lstCallLog.Column(0) 'Problem code
Else
With lstCallLog
.Visible = False
For intI = 0 To .ListCount
.Selected(intI) = True
If .Column(0) = lngCallID Then Exit For
Next intI
.Visible = True
End With
End If
Me.txtCallLogCaller.Requery
Me.txtCallLogDate.Requery
Me.txtCallLogNote.Requery
Else
lngCallID = 0
End If
I have narrowed down the problem to the "Problem code" indicated
above. But why is this triggering the LB1_AfterUpdate event??? How
can I auto-select the first row in LB2?
Many thanks,
Patti
another listbox (LB2) that displays a list of phone calls made to the
client selected in LB1. I want to auto-select the first row in LB2
after the user selects a client in LB1. I can get all this to work
just fine. The problem is that when I click LB2, the LB1_AfterUpdate
is triggered. HUH??? I have verified that this is really happening
by putting in debug.print "proc_name" into my procedures. When the
user selects a client in LB1, the following code snippet is run, which
populates LB2 and selects the first row:
strSQL = "SQL statement here"
Me.lstCallLog.RowSource = strSQL
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
If lngCallID = 0 Then
Me.lstCallLog.Selected(0) = True 'Problem code
lngCallID = Me.lstCallLog.Column(0) 'Problem code
Else
With lstCallLog
.Visible = False
For intI = 0 To .ListCount
.Selected(intI) = True
If .Column(0) = lngCallID Then Exit For
Next intI
.Visible = True
End With
End If
Me.txtCallLogCaller.Requery
Me.txtCallLogDate.Requery
Me.txtCallLogNote.Requery
Else
lngCallID = 0
End If
I have narrowed down the problem to the "Problem code" indicated
above. But why is this triggering the LB1_AfterUpdate event??? How
can I auto-select the first row in LB2?
Many thanks,
Patti