Results 1 to 3 of 3

Thread: Select

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Select

    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

  2. #2
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Select

    Try this.

    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.MoveFirst
    14.  
    15. If AdoDatiSoggetto.Recordset.EOF Then
    16.     AdoDatiSoggetto.Recordset.MovePrevious
    17. End If
    18. Loop
    19.  
    20. rs.Close
    21.  
    22. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2007
    Posts
    12

    Re: Select

    it doesn't do anything just shows me the first record all the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width