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
| Function CreerTable()
Dim bds As Database
Dim dft As TableDef
Dim chp As Field
Dim NomTb As String
NomTb = "TEff" & Environ("COMPUTERNAME")
Set bds = CurrentDb
bds.TableDefs.Refresh
For Each dft In bds.TableDefs
If dft.Name = NomTb Then
bds.TableDefs.Delete dft.Name
End If
Next dft
Set dft = bds.CreateTableDef(NomTb)
Set chp = dft.CreateField("Nom du contact", dbText, 40)
dft.Fields.Append chp
Set chp = dft.CreateField("Jour", dbDate)
dft.Fields.Append chp
Set chp = dft.CreateField("Val1", dbByte)
dft.Fields.Append chp
dft.Fields.Refresh
bds.TableDefs.Append dft
bds.TableDefs.Refresh
Set bds = Nothing
DoCmd.OpenTable NomTb, acViewDesign
CurrentDb.TableDefs(NomTb)("Val1").Properties("caption").Value = "Opératrice"
CurrentDb.TableDefs(NomTb)("Jour").Properties("format").Value = "jj/mm/aaaa"
DoCmd.Close acTable, NomTb, acSaveYes
End Function |
Partager