allora... ho un listbox il cui contenuto è un rs di un database. Voglio fare in modo ke appena si seleziona una voce (caratterizzata da Cognome e Nome) escano i dati relativi all'utente...
A livello di codice... sono messo così:

codice:
Option Explicit

Private DB As Database
Private RS As Recordset

Private Sub Visualizza()
    If RS!Rs_Nome <> "" Then
        txt_nome.Text = RS!Rs_Nome
    Else
        txt_nome.Text = ""
    End If
    If RS!Rs_cognome <> "" Then
        txt_cognome.Text = RS!Rs_cognome
    Else
        txt_cognome.Text = ""
    End If
    If RS!Rs_indirizzo <> "" Then
        txt_indirizzo.Text = RS!Rs_indirizzo
    Else
        txt_indirizzo.Text = ""
    End If
    If RS!Rs_email <> "" Then
        txt_email.Text = RS!Rs_email
    Else
        txt_email.Text = ""
    End If
    If RS!Rs_sito <> "" Then
        txt_sito.Text = RS!Rs_sito
    Else
        txt_sito.Text = ""
    End If
    If RS!Rs_icq <> "" Then
        txt_icq.Text = RS!Rs_icq
    Else
        txt_icq.Text = ""
    End If
    If RS!Rs_nick <> "" Then
        txt_nick.Text = RS!Rs_nick
    Else
        txt_nick.Text = ""
    End If
    If RS!Rs_telcasa <> "" Then
        txt_ncasa.Text = RS!Rs_telcasa
    Else
        txt_ncasa.Text = ""
    End If
    If RS!Rs_teluff <> "" Then
        txt_nuff.Text = RS!Rs_teluff
    Else
        txt_nuff.Text = ""
    End If
    If RS!Rs_fax <> "" Then
        txt_nfax.Text = RS!Rs_fax
    Else
        txt_nfax.Text = ""
    End If
    If RS!Rs_cell1 <> "" Then
        txt_ncell1.Text = RS!Rs_cell1
    Else
        txt_ncell1.Text = ""
    End If
    If RS!Rs_cell2 <> "" Then
        txt_ncell2.Text = RS!Rs_cell2
    Else
        txt_ncell2.Text = ""
    End If
    If RS!Rs_altro <> "" Then
        txt_altro.Text = RS!Rs_altro
    Else
        txt_altro.Text = ""
    End If
End Sub

Private Sub ApriRecordSet(Filtro As String)
    Dim Gira As Integer
    
    Set RS = DB.OpenRecordset(Filtro)
    txt_user.Clear
    RS.MoveFirst
    For Gira = 1 To RS.RecordCount
                txt_user.AddItem RS!Rs_cognome & " " & RS!Rs_Nome
            RS.MoveNext
    Next Gira
End Sub

Private Sub Command5_Click()
    End
End Sub

Private Sub Form_Load()
    Set DB = OpenDatabase(App.Path & "\db97.mdb")
    ApriRecordSet ("SELECT * FROM tbl_dati ORDER BY Rs_Cognome,Rs_Nome ASC")
End Sub

Private Sub mnu_esci_Click()
    End
End Sub
Nota di moderazione: ho aggiunto i tag CODE (vedere regolamento).