1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Sub update_table(requete As String, table As String, col_Account As String, col_SN As String, col_SR As String, col_Desc_SN As String, col_Env As String, col_Env_exist As Boolean)
Dim dbs As DAO.Database
Dim rsSQL As DAO.Recordset
Dim strSQL As String
Set dbs = CurrentDb
'Open a snapshot-type Recordset based on an SQL statement
strSQL = requete
Set rsSQL = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
'Begin row processing
Do While Not rsSQL.EOF
Account = rsSQL![col_Account]
SN = rsSQL![col_SN]
SystemRole = rsSQL![col_SR]
'choix de la colonne description du sr si cette colonne existe
If col_Desc_SN = "" Then
SystemRoleDescription = "N/A"
Else
SystemRoleDescription = rsSQL![col_Desc_SN]
End If
' choix de l'environnement
If col_Env_exist Then
Environnement = rsSQL![col_Env]
Else
Environnement = col_Env
End If
If Left(Account, 3) = "ACC" Then
Call Ajouter_Utilisateur(dbs, table, Account, SystemRole, SystemRoleDescription, Environnement)
Else
Call Ajouter_Utilisateur_Non_Trouve(dbs, table, Account)
End If
rsSQL.MoveNext
Loop
'Cleanup
rsSQL.Close
End Sub |
Partager