Extrait de l'aide d'Access : Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause)
Cet exemple crée une nouvelle table nommée ThisTable comportant deux champs text.
Sub CreateTableX1()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with two text fields.
dbs.Execute "CREATE TABLE ThisTable " _
& "(FirstName CHAR, LastName CHAR, " _
dbs.Close
End Sub
Cet exemple crée une nouvelle table nommée MyTable comportant deux champs text, un champ Date/Time et un index unique composé des trois champs
Sub CreateTableX2()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a unique
' index made up of all three fields.
dbs.Execute "CREATE TABLE MyTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "[DateOfBirth] DATETIME, " _
& "CONSTRAINT MyTableConstraint UNIQUE " _
& "(FirstName, LastName, [DateOfBirth]));"
dbs.Close
End Sub
Cet exemple crée une nouvelle table comportant deux champs text et un champ integer. Le champ SSN constitue la clé primaire.
Sub CreateTableX3()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a ^primary
' key.
dbs.Execute "CREATE TABLE NewTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "SSN INTEGER CONSTRAINT MyFieldConstraint " _
& "PRIMARY KEY);"
dbs.Close
End Sub
-- Cordialement,
Gilbert
"Michel B" a écrit dans le message de news:485a0df8$0$4533$
Bonjours a tous,
Je souhaite créer une table avec 4 champs, mais ne sais pas comment on sépare les champs en VBA :
CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll ,[Saison] Str )
Quelques explications serait le bienvenue
D'avance merci Michel
Michel B
Bonjour Gilbert,
Merci pour ton aide
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif " qui doit être un champ Oui/Non génére une erreur. Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents type de champs
Dim dbs As Database Set dbs = OpenDatabase("C:BaseBase2003.mdb") dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure LONG, Saison CHAR, Actif BOOL) " dbs.Close
Encore merci Michel
"Gilbert" a écrit dans le message de news: %
Bonjour,
Extrait de l'aide d'Access : Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause)
Cet exemple crée une nouvelle table nommée ThisTable comportant deux champs text.
Sub CreateTableX1()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with two text fields.
dbs.Execute "CREATE TABLE ThisTable " _
& "(FirstName CHAR, LastName CHAR, " _
dbs.Close
End Sub
Cet exemple crée une nouvelle table nommée MyTable comportant deux champs text, un champ Date/Time et un index unique composé des trois champs
Sub CreateTableX2()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a unique
' index made up of all three fields.
dbs.Execute "CREATE TABLE MyTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "[DateOfBirth] DATETIME, " _
& "CONSTRAINT MyTableConstraint UNIQUE " _
& "(FirstName, LastName, [DateOfBirth]));"
dbs.Close
End Sub
Cet exemple crée une nouvelle table comportant deux champs text et un champ integer. Le champ SSN constitue la clé primaire.
Sub CreateTableX3()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a ^primary
' key.
dbs.Execute "CREATE TABLE NewTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "SSN INTEGER CONSTRAINT MyFieldConstraint " _
& "PRIMARY KEY);"
dbs.Close
End Sub
-- Cordialement,
Gilbert
"Michel B" a écrit dans le message de news:485a0df8$0$4533$
Bonjours a tous,
Je souhaite créer une table avec 4 champs, mais ne sais pas comment on sépare les champs en VBA :
CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll ,[Saison] Str )
Quelques explications serait le bienvenue
D'avance merci Michel
Bonjour Gilbert,
Merci pour ton aide
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif "
qui doit être un champ Oui/Non génére une erreur.
Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents type
de champs
Dim dbs As Database
Set dbs = OpenDatabase("C:BaseBase2003.mdb")
dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure
LONG, Saison CHAR, Actif BOOL) "
dbs.Close
Encore merci
Michel
"Gilbert" <ZZZZgilbertvie@tiscali.fr> a écrit dans le message de news:
%23mqCVKe0IHA.5520@TK2MSFTNGP04.phx.gbl...
Bonjour,
Extrait de l'aide d'Access :
Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause)
Cet exemple crée une nouvelle table nommée ThisTable comportant deux
champs
text.
Sub CreateTableX1()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with two text fields.
dbs.Execute "CREATE TABLE ThisTable " _
& "(FirstName CHAR, LastName CHAR, " _
dbs.Close
End Sub
Cet exemple crée une nouvelle table nommée MyTable comportant deux champs
text, un champ Date/Time et un index unique composé des trois champs
Sub CreateTableX2()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a unique
' index made up of all three fields.
dbs.Execute "CREATE TABLE MyTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "[DateOfBirth] DATETIME, " _
& "CONSTRAINT MyTableConstraint UNIQUE " _
& "(FirstName, LastName, [DateOfBirth]));"
dbs.Close
End Sub
Cet exemple crée une nouvelle table comportant deux champs text et un
champ
integer. Le champ SSN constitue la clé primaire.
Sub CreateTableX3()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a ^primary
' key.
dbs.Execute "CREATE TABLE NewTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "SSN INTEGER CONSTRAINT MyFieldConstraint " _
& "PRIMARY KEY);"
dbs.Close
End Sub
--
Cordialement,
Gilbert
"Michel B" <michel_b@libertysurf.fr> a écrit dans le message de
news:485a0df8$0$4533$426a34cc@news.free.fr...
Bonjours a tous,
Je souhaite créer une table avec 4 champs, mais ne sais pas comment on
sépare les champs en VBA :
CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll
,[Saison] Str )
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif " qui doit être un champ Oui/Non génére une erreur. Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents type de champs
Dim dbs As Database Set dbs = OpenDatabase("C:BaseBase2003.mdb") dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure LONG, Saison CHAR, Actif BOOL) " dbs.Close
Encore merci Michel
"Gilbert" a écrit dans le message de news: %
Bonjour,
Extrait de l'aide d'Access : Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause)
Cet exemple crée une nouvelle table nommée ThisTable comportant deux champs text.
Sub CreateTableX1()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with two text fields.
dbs.Execute "CREATE TABLE ThisTable " _
& "(FirstName CHAR, LastName CHAR, " _
dbs.Close
End Sub
Cet exemple crée une nouvelle table nommée MyTable comportant deux champs text, un champ Date/Time et un index unique composé des trois champs
Sub CreateTableX2()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a unique
' index made up of all three fields.
dbs.Execute "CREATE TABLE MyTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "[DateOfBirth] DATETIME, " _
& "CONSTRAINT MyTableConstraint UNIQUE " _
& "(FirstName, LastName, [DateOfBirth]));"
dbs.Close
End Sub
Cet exemple crée une nouvelle table comportant deux champs text et un champ integer. Le champ SSN constitue la clé primaire.
Sub CreateTableX3()
Dim dbs As Database
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase(".mdb")
' Create a table with three fields and a ^primary
' key.
dbs.Execute "CREATE TABLE NewTable " _
& "(FirstName CHAR, LastName CHAR, " _
& "SSN INTEGER CONSTRAINT MyFieldConstraint " _
& "PRIMARY KEY);"
dbs.Close
End Sub
-- Cordialement,
Gilbert
"Michel B" a écrit dans le message de news:485a0df8$0$4533$
Bonjours a tous,
Je souhaite créer une table avec 4 champs, mais ne sais pas comment on sépare les champs en VBA :
CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll ,[Saison] Str )
Quelques explications serait le bienvenue
D'avance merci Michel
Gilbert
As-tu essayé avec BOOLEAN?
-- Cordialement,
Gilbert
"Michel B" a écrit dans le message de news:485a2c43$0$19721$
Bonjour Gilbert,
Merci pour ton aide
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif
"
qui doit être un champ Oui/Non génére une erreur. Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents
type
de champs
Dim dbs As Database Set dbs = OpenDatabase("C:BaseBase2003.mdb") dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure LONG, Saison CHAR, Actif BOOL) " dbs.Close
Encore merci Michel
"Gilbert" a écrit dans le message de news: % > Bonjour, > > Extrait de l'aide d'Access : > Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause) > > Cet exemple crée une nouvelle table nommée ThisTable comportant deux > champs > text. > > Sub CreateTableX1() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with two text fields. > > dbs.Execute "CREATE TABLE ThisTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > > dbs.Close > > > End Sub > > > Cet exemple crée une nouvelle table nommée MyTable comportant deux
champs
> text, un champ Date/Time et un index unique composé des trois champs > > Sub CreateTableX2() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with three fields and a unique > > ' index made up of all three fields. > > dbs.Execute "CREATE TABLE MyTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > & "[DateOfBirth] DATETIME, " _ > > & "CONSTRAINT MyTableConstraint UNIQUE " _ > > & "(FirstName, LastName, [DateOfBirth]));" > > > dbs.Close > > > End Sub > > > Cet exemple crée une nouvelle table comportant deux champs text et un > champ > integer. Le champ SSN constitue la clé primaire. > > Sub CreateTableX3() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with three fields and a ^primary > > ' key. > > dbs.Execute "CREATE TABLE NewTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > & "SSN INTEGER CONSTRAINT MyFieldConstraint " _ > > & "PRIMARY KEY);" > > > dbs.Close > > > End Sub > > > -- > Cordialement, > > Gilbert > > > "Michel B" a écrit dans le message de > news:485a0df8$0$4533$ >> >> Bonjours a tous, >> >> Je souhaite créer une table avec 4 champs, mais ne sais pas comment on >> sépare les champs en VBA : >> >> CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll >> ,[Saison] Str ) >> >> Quelques explications serait le bienvenue >> >> D'avance merci >> Michel >> >> > >
As-tu essayé avec BOOLEAN?
--
Cordialement,
Gilbert
"Michel B" <michel_b@libertysurf.fr> a écrit dans le message de
news:485a2c43$0$19721$426a34cc@news.free.fr...
Bonjour Gilbert,
Merci pour ton aide
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif
"
qui doit être un champ Oui/Non génére une erreur.
Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents
type
de champs
Dim dbs As Database
Set dbs = OpenDatabase("C:BaseBase2003.mdb")
dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure
LONG, Saison CHAR, Actif BOOL) "
dbs.Close
Encore merci
Michel
"Gilbert" <ZZZZgilbertvie@tiscali.fr> a écrit dans le message de news:
%23mqCVKe0IHA.5520@TK2MSFTNGP04.phx.gbl...
> Bonjour,
>
> Extrait de l'aide d'Access :
> Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause)
>
> Cet exemple crée une nouvelle table nommée ThisTable comportant deux
> champs
> text.
>
> Sub CreateTableX1()
>
>
> Dim dbs As Database
>
>
> ' Modify this line to include the path to Northwind
>
> ' on your computer.
>
> Set dbs = OpenDatabase(".mdb")
>
>
> ' Create a table with two text fields.
>
> dbs.Execute "CREATE TABLE ThisTable " _
>
> & "(FirstName CHAR, LastName CHAR, " _
>
>
> dbs.Close
>
>
> End Sub
>
>
> Cet exemple crée une nouvelle table nommée MyTable comportant deux
champs
> text, un champ Date/Time et un index unique composé des trois champs
>
> Sub CreateTableX2()
>
>
> Dim dbs As Database
>
>
> ' Modify this line to include the path to Northwind
>
> ' on your computer.
>
> Set dbs = OpenDatabase(".mdb")
>
>
> ' Create a table with three fields and a unique
>
> ' index made up of all three fields.
>
> dbs.Execute "CREATE TABLE MyTable " _
>
> & "(FirstName CHAR, LastName CHAR, " _
>
> & "[DateOfBirth] DATETIME, " _
>
> & "CONSTRAINT MyTableConstraint UNIQUE " _
>
> & "(FirstName, LastName, [DateOfBirth]));"
>
>
> dbs.Close
>
>
> End Sub
>
>
> Cet exemple crée une nouvelle table comportant deux champs text et un
> champ
> integer. Le champ SSN constitue la clé primaire.
>
> Sub CreateTableX3()
>
>
> Dim dbs As Database
>
>
> ' Modify this line to include the path to Northwind
>
> ' on your computer.
>
> Set dbs = OpenDatabase(".mdb")
>
>
> ' Create a table with three fields and a ^primary
>
> ' key.
>
> dbs.Execute "CREATE TABLE NewTable " _
>
> & "(FirstName CHAR, LastName CHAR, " _
>
> & "SSN INTEGER CONSTRAINT MyFieldConstraint " _
>
> & "PRIMARY KEY);"
>
>
> dbs.Close
>
>
> End Sub
>
>
> --
> Cordialement,
>
> Gilbert
>
>
> "Michel B" <michel_b@libertysurf.fr> a écrit dans le message de
> news:485a0df8$0$4533$426a34cc@news.free.fr...
>>
>> Bonjours a tous,
>>
>> Je souhaite créer une table avec 4 champs, mais ne sais pas comment on
>> sépare les champs en VBA :
>>
>> CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll
>> ,[Saison] Str )
>>
>> Quelques explications serait le bienvenue
>>
>> D'avance merci
>> Michel
>>
>>
>
>
"Michel B" a écrit dans le message de news:485a2c43$0$19721$
Bonjour Gilbert,
Merci pour ton aide
J'ai fait cela et ça fonctionne bien, jusqu'a "Saison" en revanche "Actif
"
qui doit être un champ Oui/Non génére une erreur. Je ne trouve pas dans l'aide la syntaxe a utiliser pour les différents
type
de champs
Dim dbs As Database Set dbs = OpenDatabase("C:BaseBase2003.mdb") dbs.Execute "CREATE TABLE Mutations (N°Adherent LONG, N°Structure LONG, Saison CHAR, Actif BOOL) " dbs.Close
Encore merci Michel
"Gilbert" a écrit dans le message de news: % > Bonjour, > > Extrait de l'aide d'Access : > Exemples avec CREATE TABLE (instruction) et CONSTRAINT (clause) > > Cet exemple crée une nouvelle table nommée ThisTable comportant deux > champs > text. > > Sub CreateTableX1() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with two text fields. > > dbs.Execute "CREATE TABLE ThisTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > > dbs.Close > > > End Sub > > > Cet exemple crée une nouvelle table nommée MyTable comportant deux
champs
> text, un champ Date/Time et un index unique composé des trois champs > > Sub CreateTableX2() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with three fields and a unique > > ' index made up of all three fields. > > dbs.Execute "CREATE TABLE MyTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > & "[DateOfBirth] DATETIME, " _ > > & "CONSTRAINT MyTableConstraint UNIQUE " _ > > & "(FirstName, LastName, [DateOfBirth]));" > > > dbs.Close > > > End Sub > > > Cet exemple crée une nouvelle table comportant deux champs text et un > champ > integer. Le champ SSN constitue la clé primaire. > > Sub CreateTableX3() > > > Dim dbs As Database > > > ' Modify this line to include the path to Northwind > > ' on your computer. > > Set dbs = OpenDatabase(".mdb") > > > ' Create a table with three fields and a ^primary > > ' key. > > dbs.Execute "CREATE TABLE NewTable " _ > > & "(FirstName CHAR, LastName CHAR, " _ > > & "SSN INTEGER CONSTRAINT MyFieldConstraint " _ > > & "PRIMARY KEY);" > > > dbs.Close > > > End Sub > > > -- > Cordialement, > > Gilbert > > > "Michel B" a écrit dans le message de > news:485a0df8$0$4533$ >> >> Bonjours a tous, >> >> Je souhaite créer une table avec 4 champs, mais ne sais pas comment on >> sépare les champs en VBA : >> >> CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll >> ,[Saison] Str ) >> >> Quelques explications serait le bienvenue >> >> D'avance merci >> Michel >> >> > >
3stone
Salut,
"Michel B" | Je souhaite créer une table avec 4 champs, mais ne sais pas comment on | sépare les champs en VBA : | | CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll | ,[Saison] Str ) | | Quelques explications serait le bienvenue
"Michel B"
| Je souhaite créer une table avec 4 champs, mais ne sais pas comment on
| sépare les champs en VBA :
|
| CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll
| ,[Saison] Str )
|
| Quelques explications serait le bienvenue
"Michel B" | Je souhaite créer une table avec 4 champs, mais ne sais pas comment on | sépare les champs en VBA : | | CREATE TABLE ([N°Adherent] LONG , [N°Structure] LONG , [Actif] CBoll | ,[Saison] Str ) | | Quelques explications serait le bienvenue