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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| Private Sub comp_Click()
Dim sql As Recordset
Dim col As New Collection
Dim ctl As Control
Dim str As String
Dim i As Integer, j As Integer
dim f as [Form_Selection des compétences]
DoCmd.OpenForm "Selection des compétences", acDesign
set f=forms("Selection des compétences")
For Each ctrl In f.Controls
MsgBox ctrl.Name
If ctrl.ControlType = acCheckBox Then
DeleteControl "Selection des compétences", ctrl.Name
End If
If ctrl.ControlType = acLabel Then
DeleteControl "Selection des compétences", ctrl.Name
End If
Next ctrl
set f=nothing
i = 0
Set sql = CurrentDb().OpenRecordset("select * from competence_salle")
Do While Not sql.EOF
str = sql!competence
col.Add str
sql.MoveNext
Loop
sql.Close
Set sql = Nothing
Set sql = CurrentDb().OpenRecordset("select * from competence_cuisine")
Do While Not sql.EOF
str = sql!competence
col.Add str
sql.MoveNext
Loop
sql.Close
Set sql = Nothing
Set sql = CurrentDb().OpenRecordset("select * from competence_maintenance")
Do While Not sql.EOF
str = sql!competence
col.Add str
sql.MoveNext
Loop
sql.Close
Set sql = Nothing
Set sql = CurrentDb().OpenRecordset("select * from competence_reception")
Do While Not sql.EOF
str = sql!competence
col.Add str
sql.MoveNext
Loop
sql.Close
Set sql = Nothing
Set sql = CurrentDb().OpenRecordset("select * from competence_etage")
Do While Not sql.EOF
str = sql!competence
col.Add str
sql.MoveNext
Loop
sql.Close
Set sql = Nothing
For i = 1 To col.Count
Set ctl = Application.CreateControl("Selection des compétences", acCheckBox, , , Control & CStr(i), 500, i * 500)
Set ctl = Nothing
Set ctl = Application.CreateControl("Selection des compétences", acLabel, , , col(i), 950, i * 500)
Set ctl = Nothing
Next i
DoCmd.OpenForm "Selection des compétences", acNormal
End Sub |
Partager