N
Niklas Östergren
Hi!
I have never used listboxes before (haven´t hade any reason untill now).
I have a form <frmAddAttachmentsToEmailMsg> in which I have one combobox
<cboSearchFileName> and one listbox <lstSelectFileName>. In the listbox
AfterUpdate_Event I have following code:
'==================================
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[DocumentID] = " & Str(Nz(Me![lstSelectFileName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
'==================================
When I mark a record in the listbox the record is highlighted, which is
exactly what I want.
Now to my problem:
I use the combobox to search for records which I then want to be highlited
(selected) in the listbox. When I select a record in the combobox the form
is uppdated with the record that I have searched for. BUT the record is NOT
highlighted in the listbox, which I want it to be. Since it´s much easyer to
see which record that have been selected.
I have following code in the combobox AfterUpdate_Event
'=======================================
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[DocumentID] = " & Str(Nz(Me![cboSearchFileName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.lstSelectFileName.SetFocus
Me.cboSearchFileName = ""
'========================================
If there is abetter way of doing this then to use a combobox please let me
know.
One way could be to use a texbox where the user types in the name of the
record that they want to be highlighted in the listbox and that the listbox
highlight the record that match the textbox on the fly. But this may not be
a good idéa. And I surtanly doesn´t know how to implement it.
TIA!
// Niklas
I have never used listboxes before (haven´t hade any reason untill now).
I have a form <frmAddAttachmentsToEmailMsg> in which I have one combobox
<cboSearchFileName> and one listbox <lstSelectFileName>. In the listbox
AfterUpdate_Event I have following code:
'==================================
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[DocumentID] = " & Str(Nz(Me![lstSelectFileName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
'==================================
When I mark a record in the listbox the record is highlighted, which is
exactly what I want.
Now to my problem:
I use the combobox to search for records which I then want to be highlited
(selected) in the listbox. When I select a record in the combobox the form
is uppdated with the record that I have searched for. BUT the record is NOT
highlighted in the listbox, which I want it to be. Since it´s much easyer to
see which record that have been selected.
I have following code in the combobox AfterUpdate_Event
'=======================================
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[DocumentID] = " & Str(Nz(Me![cboSearchFileName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.lstSelectFileName.SetFocus
Me.cboSearchFileName = ""
'========================================
If there is abetter way of doing this then to use a combobox please let me
know.
One way could be to use a texbox where the user types in the name of the
record that they want to be highlighted in the listbox and that the listbox
highlight the record that match the textbox on the fly. But this may not be
a good idéa. And I surtanly doesn´t know how to implement it.
TIA!
// Niklas