Bonjour
Pour info je te fais passer une macro que j'ai faite pour me positionner sur le premier enregistrement commençant par une lettre envoyé, cela fonctionne sous 1.1.2 avec un .dbf. Il est possible que le traitement soit long si beaucoup d'enregistrements.
Je suis aussi intéressé par d'autres solutions qui seraient plus efficaces.
Jean-luc


Sub AllerLettreTable(evenement as object)
   Dim Qte As String, OrdreTriCol As String, LettreAlpha as String
   Dim maRequete As Object, resuQuery As Object, SQL as string
   Dim x as Long, FinRecherche as Long, IndexLettre as Long
DrawPage = ThisComponent.CurrentController.ActiveSheet.DrawPage 'sélectionne la partie graphique de la feuille Form = DrawPage.Forms.GetByIndex(0)'sélectionne les contrôle de formulaire Control = Form.getByName("TableControl")'sélectionne le controle par son nom If Form.IsModified = true then Form.UpdateRow ' si formulaire modifié alors on actualise 'On récupére la lettre du bouton 'LettreAlpha = evenement.source.Model.Label 'Lettre du control LettreAlpha = "M"
     ConnecterSource
     'on cherche la postion de l'élément qui commence par la lettre
     maRequete = maConnexion.createStatement()
     SQL =  "select * from "& NomTable & " order by ID_CONTACT"
     resuQuery = maRequete.executeQuery(SQL)
     x=0
     FinRecherche =0
     While  resuQuery.next
        x=x +1
       if FinRecherche =0 then
if left(resuQuery.Columns.getByName("ID_CONTACT").string,1)=LettreAlpha then
               FinRecherche =1
IndexLettre = x end if End if wend
     'print IndexLettre,IndexLettre+24,x

         Form.Absolute(IndexLettre)
DeconnecterSource
   'end if
End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à