Bonjour membres du Forum!
Veuiller me faciliter à trouver un CODE PERMETTANT DE CREER DES CHAMPS DANS UNE TABLE ACCESS.:ccool:
Version imprimable
Bonjour membres du Forum!
Veuiller me faciliter à trouver un CODE PERMETTANT DE CREER DES CHAMPS DANS UNE TABLE ACCESS.:ccool:
morobaboumar,
La lecture de ce sujet correspond à tes attentes
http://msdn.microsoft.com/en-us/libr.../ff821396.aspx
Autre technique le Alter Table (suivant ta version Access)
http://access.developpez.com/sql/#L2.2.1
Bonne lecture
JimBoLion
Un autre document :
http://warin.developpez.com/access/d...tie_4#L4.4.4.3
;)
1°)J'approfondis la recherche...Code:
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 'L'exemple suivant montre comment créer un champ calculé. La méthode CreateField _ crée un champ nommé FullName. La propriété Expression est ensuite définie sur l'expression _ qui calcule la valeur du champ. Sub CreateCalculatedField() Dim dbs As DAO.Database Dim tdf As DAO.TableDef Dim fld As DAO.Field2 ' get the database Set dbs = CurrentDb() ' create the table Set tdf = dbs.CreateTableDef("tblContactsCalcField") ' create the fields: first name, last name tdf.Fields.Append tdf.CreateField("FirstName", dbText, 20) tdf.Fields.Append tdf.CreateField("LastName", dbText, 20) ' create the calculated field: full name Set fld = tdf.CreateField("FullName", dbText, 50) fld.Expression = "[FirstName] & "" "" & [LastName]" tdf.Fields.Append fld ' append the table and cleanup dbs.TableDefs.Append tdf Cleanup: Set fld = Nothing Set tdf = Nothing Set dbs = Nothing End Sub