list box, move to record selected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

On top of my clients form I have a listbox listing all clients. What code do
I need to use in order to move the current client on the form to the client
selected in the listbox?

thanks in advance, george
 
hello george
let's say you want the record to show when the user double-clicks the client
name in the list box:
first, make sure the bound column of the listbox is the clientID field
then use this:
Private Sub lstClients_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "clientID=" & lstClients
If rs.NoMatch = False Then Me.Bookmark = rs.Bookmark
rs.Close
Set rs = Nothing
End Sub

you'll need to set a reference to DAO to use this one.
Good luck,
Erez.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top