Superpat
Member
- Local time
 - Today, 12:13
 
- Joined
 - Aug 15, 2020
 
- Messages
 - 121
 
Hello Ihave this error, expected table :
:
		
	
my code :
	
	
	
		
	
	
	
		
Any help,thanks
 :
my code :
		Code:
	
	
	Function fnDmwListAllModulesDeroulantes(lComptageModules As String) As String
        ' Liste les tables dans le fichier "t_ListeDeroulante dans t_OperationSauvegarde_SuperPatrickCourant_28/02/2002
        'On Error GoTo errHandler
        Dim obj As AccessObject, db As Object
        Dim bolExiste As Boolean
        Dim Table_Name As String
        Dim dbs     As DAO.Database
        Dim oRst    As DAO.Recordset
        Dim oDb     As DAO.Database
        Set oDb = CurrentDb
        Table_Name = "t_ListeDeroulanteModules"
        Set oRst = oDb.OpenRecordset(Table_Name, dbOpenDynaset)
        Set db = Application.CurrentProject
        For Each obj In db.AllModules
                With oRst
                        bolExiste = RechercheIntitule1(obj.Name, strSearch)
                        If bolExiste = True Then
                                Debug.Print "Existe : " & obj.Name
                        Else
                                .AddNew
                                ![Liste_Modules] = obj.Name
                                .Update
                        End If
                End With
        Next obj
        oRst.Close
        oDb.Close
        Set oRst = Nothing
        Set oDb = Nothing
        Dim strSQLComptageOperation As Long
        lComptageModules = DCount("Liste_Modules", Table_Name)
        'Debug.Print lComptageModules
        fnDmwListAllModulesDeroulantes = lComptageModules
procDone:
        Exit Function
errHandler:
        MsgBox Err.Number & " " & Err.Description
        Resume procDone
End Function
	
		Code:
	
	
	Function RechercheIntitule1(strModuleName As String, strSearch As String) As Boolean
        'Procédure qui vérifie si le titre existe.
        Debug.Print strModuleName
        Debug.Print strSearch
10      On Error GoTo errSub
        ' Open module.
        'DoCmd.OpenModule strModuleName
11       Set mdl = Modules(strModuleName)
12      strNomProcedure = "RechercheIntitule1"
        ' Return reference to Module object.
14      If mdl.Find(strSearch, 1, 1, -1, -1, False, False, False) Then
                ' On trouve l'intitulé
16              RechercheIntitule1 = True
18      Else
20              RechercheIntitule1 = False
22      End If
Exitsub:
24      On Error GoTo 0
26      Exit Function
errSub:
        Select Case fGestError1(strNomProcedure, Err, Erl, Err.Description)
                Case vbAbort
28                      End
                Case vbRetry
30                      Resume
                Case vbIgnore
32                      Resume Next
        End Select
End Function