je n'ai jamais fait du VBA, seulement des programmes compilés en Vb...Si tu veux le déboguer tu le mets sur une feuille vierge et tu suis les instructions de débogage, il va te le dire...tu as déjà des choses qui me paraissent curieuse :
 
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"  
Begin VB.Form Frequency  
  Caption         =   "Frequency Distribution"  
  ClientHeight    =   5175  
  ClientLeft      =   6120  
  ClientTop       =   5625  
  ClientWidth     =   5610  
  LinkTopic       =   "Form1"  
  ScaleHeight     =   5175  
  ScaleWidth      =   5610  
  Begin MSComDlg.CommonDialog CommonDialog1  
     Left            =   2640  
     Top             =   240  
     _ExtentX        =   847  
     _ExtentY        =   847  
     _Version        =   327681  
  End  
  Begin VB.CommandButton File  
     Caption         =   "Select Database File"  
     Height          =   375  
     Left            =   120  
     TabIndex        =   4  
     Top             =   360  
     Width           =   2415  
  End  
  Begin VB.CommandButton Back  
     Caption         =   "Back "  
     Height          =   375  
     Left            =   3240  
     TabIndex        =   3  
     Top             =   4320  
     Width           =   1815  
  End  
  Begin VB.CommandButton Show  
     Caption         =   "Show it!"  
     Height          =   375  
     Left            =   360  
     TabIndex        =   2  
     Top             =   4320  
     Width           =   1695  
  End  
  Begin VB.ListBox field_list  
     Height          =   2985  
     Left            =   2880  
     TabIndex        =   1  
     Top             =   960  
     Width           =   2535  
  End  
  Begin VB.ListBox table_list  
     Height          =   2985  
     Left            =   120  
     TabIndex        =   0  
     Top             =   960  
     Width           =   2415  
  End  
End 
 
toutes ces partis ne sont pas mis dans des fonctions ou procédure, ce n'ets pas normal...ensuite : qu'est ce que vient faire cette clé :  
 
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX" 
 
elle appartient à la base de registre, c'est l'enregistrement, dans les BDR...
 
 
ensuite, tu as ceci qui me parait aussi curieux, ca ressemble à des fichiers dépendance :
 
Attribute VB_Name = "Frequency"  
Attribute VB_GlobalNameSpace = False  
Attribute VB_Creatable = False  
Attribute VB_PredeclaredId = True  
Attribute VB_Exposed = False 
 
ceci sont des variables, que tu devra mettre dans des modules :
 
Public dbMydb As Database  
Public recMyRec As Recordset  
Public sMyField As String 
 
le reste ce sont des prcédures normal, asscociès à des objets divers :
 
Private Sub Back_Click()  
MsgBox "TO BE IMPLEMENTED LATER, WHEN THERE ARE MANY FUNCTIONS."  
End Sub  
 
Private Sub field_list_Click()  
   sMyField = field_list.Text  
End Sub 
 
Private Sub File_Click()  
   Dim sFile As String  
   With CommonDialog1  
       'To Do  
       'set the flags and attributes of the  
       'common dialog control  
       .Filter = "Access Files (*.mdb)|*.mdb"  
       .ShowOpen  
       If Len(.filename) = 0 Then  
           Exit Sub  
       End If  
       sFile = .filename  
   End With  
     
   Dim nCount As Integer  
   Dim sTemp As String  
     
   Set dbMydb = OpenDatabase(sFile)  
   nCount = 0  
   table_list.Clear  
   While nCount < dbMydb.TableDefs.Count  
       sTemp = dbMydb.TableDefs(nCount).Name  
       If Not sTemp Like "MSys*" Then  
           table_list.AddItem dbMydb.TableDefs(nCount).Name  
       End If  
           nCount = nCount + 1  
   Wend  
   For nCount = 0 To dbMydb.TableDefs.Count - 1  
       Debug.Print table_list.List(nCount)  
   Next  
     
End Sub 
Private Sub Form_Load()  
   Set recMyRec = Nothing  
End Sub  
 
Private Sub Show_Click()  
   If sMyField Like "" Then  
       MsgBox "You must select a field."  
       Exit Sub  
   End If  
   If recMyRec.Fields.Count = 0 Then  
       MsgBox "the Table is empty!"  
       Exit Sub  
   End If  
     
     
   If recMyRec.Fields(sMyField).Type = dbBigInt Or _  
       recMyRec.Fields(sMyField).Type = dbDecimal Or _  
       recMyRec.Fields(sMyField).Type = dbDouble Or _  
       recMyRec.Fields(sMyField).Type = dbDouble Or _  
       recMyRec.Fields(sMyField).Type = dbInteger Or _  
       recMyRec.Fields(sMyField).Type = dbLong Or _  
       recMyRec.Fields(sMyField).Type = dbNumeric Then  
         
   Else  
       MsgBox "This field does not have a valid data type to be plotted."  
       Exit Sub  
   End If  
   Dim plot As New FrmPlot  
   Set plot.recMy = dbMydb.OpenRecordset(table_list.Text)  
   plot.Show  
     
End Sub 
 
Private Sub table_list_Click()  
   Dim nCount As Integer  
   nCount = 0  
   Set recMyRec = dbMydb.OpenRecordset(table_list.Text)  
   field_list.Clear  
   While nCount < recMyRec.Fields.Count  
       field_list.AddItem recMyRec.Fields(nCount).Name  
       nCount = nCount + 1  
   Wend  
End Sub 
 
Message édité par macray le 24-06-2002 à 17:41:36
 ---------------
			
;) Bienvenue sur le site...:)             http://perso.wanadoo.fr/rapport