Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Creer un champ NumeroAuto par VBA

3 réponses
Avatar
SCATIZZI
Bonsoir
Pouvez vous me dire comment creer un champ numeroAuto ?
Mon code pour creer la table

Dim Db As Database, ReqTemp As QueryDef
Dim strSQL, NomTable As String
NomTable = "Antenne"
Set Db = CurrentDb

strSQL = "CREATE TABLE [" & NomTable & "] ("
strSQL = strSQL & "Id_Inventaire Long, " <<<<<<<<<< ici NumeroAuto
strSQL = strSQL & "Designation TEXT(255),"
strSQL = strSQL & "Reference TEXT(255),"
strSQL = strSQL & "Prix_Achat Currency, "
strSQL = strSQL & "Nombre Long, "
strSQL = strSQL & "Prix_Achat_Total Currency "

strSQL = strSQL & ");"

Set ReqTemp = Db.CreateQueryDef("", strSQL)
ReqTemp.Execute
ReqTemp.Close
Set Db = Nothing
Par avance merci beaucoup pour votre aide
Salutations
alain

3 réponses

Avatar
Eric
Bonjour,

Avec AutoIncrement
strSQL = strSQL & "Id_Inventaire AutoIncrement,"

Bonsoir
Pouvez vous me dire comment creer un champ numeroAuto ?



--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr

Avatar
Guy
Bonsoir
Pouvez vous me dire comment creer un champ numeroAuto ?
Mon code pour creer la table

Dim Db As Database, ReqTemp As QueryDef
Dim strSQL, NomTable As String
NomTable = "Antenne"
Set Db = CurrentDb

strSQL = "CREATE TABLE [" & NomTable & "] ("
strSQL = strSQL & "Id_Inventaire Long, " <<<<<<<<<< ici NumeroAuto


Bonjour,

NuméroAuto ou Autonumber
Numéro séquentiel unique (incrémenté de 1 en 1) ou numéro aléatoire
attribué par Microsoft Access lorsqu'un nouvel enregistrement est ajouté
à une table. Les champs NuméroAuto ne peuvent pas être modifiés. Pour
plus d'informations, consultez la

voir aussi Fieldsize et Newvalues qui spécifient la taille du nombre et
si l'incrément est séquentiel ou aléatoire;

GR
strSQL = strSQL & "Designation TEXT(255),"
strSQL = strSQL & "Reference TEXT(255),"
strSQL = strSQL & "Prix_Achat Currency, "
strSQL = strSQL & "Nombre Long, "
strSQL = strSQL & "Prix_Achat_Total Currency "

strSQL = strSQL & ");"

Set ReqTemp = Db.CreateQueryDef("", strSQL)
ReqTemp.Execute
ReqTemp.Close
Set Db = Nothing
Par avance merci beaucoup pour votre aide
Salutations
alain


Avatar
SCATIZZI
Bonsoir,
Merci beaucoup Eric ca fonctionne parfaitement
Salutations



Bonjour,

Avec AutoIncrement
strSQL = strSQL & "Id_Inventaire AutoIncrement,"

Bonsoir
Pouvez vous me dire comment creer un champ numeroAuto ?



--
A+
Eric
http://www.mpfa.info/
Archives : http://groups.google.fr/group/microsoft.public.fr.access?hl=fr