Hello

I have a form that loads user data from a table "A01_Archivio_DatiSoggetto"
There is a field "TipoPersona" and it can have 2 values "Persona Fisica, Persona Giuridica" I am trying to do a select to load only the "Peronsa Fisica" type users.

AdoDatiSoggetto is a Adoc with a Connection String "DSN=CIS"

I don't get a error but this code loads all the user with Persona Fisica and Persona Giuridica

Ehat should i do??


VB Code:
  1. Private Sub cmdNext_Click()
  2.  
  3. Dim rs As Recordset
  4. Dim NomeViaSearch As Integer
  5.  
  6. Set cn = New Connection
  7. cn.Open "CIS"
  8.  
  9. Set rs = New Recordset
  10. rs.Open "Select TipoPersona From [A01_Archivio_DatiSoggetto] Where TipoPersona = 'Persona Fisica'", cn, adOpenStatic, adLockOptimistic
  11.  
  12. Do Until rs.EOF
  13. AdoDatiSoggetto.Recordset.MoveNext
  14.  
  15. If AdoDatiSoggetto.Recordset.EOF Then
  16.     AdoDatiSoggetto.Recordset.MovePrevious
  17. End If
  18. Loop
  19.  
  20. rs.Close
  21.  
  22. End Sub

Thanks