OVH Cloud OVH Cloud

champ boolean

2 réponses
Avatar
Patrice
bonjour,

Je modifie par VB, un champ text en champ boolean comme suit :

CurrentDb.Execute "ALTER TABLE application ALTER COLUMN [" & nom du champ &
"] bit"

comment faire pour ds la zone format lui dire que c'est du vrai/faux et
surtout en liste choix préciser "case à cocher" tjs en VB bien sûr

Merci

2 réponses

Avatar
Eric
re,

Quelque chose comme :

Sub zz()
' Charger Microsoft DAO 3.x Object Library
'CurrentDb.Execute "Alter table LaTable alter column LeChamp bit"
Dim bd As DAO.Database
Dim t As DAO.TableDef
Dim f As Field, prp As DAO.Property
Set bd = CurrentDb
Set t = bd.TableDefs("LaTable")
Set f = t.Fields("LeChamp")
f.Properties("DisplayControl") = acCheckBox
Set prp = f.CreateProperty("Format", dbText, "True/False")
f.Properties.Append prp
Set prp = Nothing
Set f = Nothing
Set t = Nothing
bd.Close
Set bd = Nothing
DoCmd.OpenTable "LaTable", acViewDesign ' pour voir la case à cocher
End Sub


bonjour,

Je modifie par VB, un champ text en champ boolean comme suit :

CurrentDb.Execute "ALTER TABLE application ALTER COLUMN [" & nom du champ &
"] bit"

comment faire pour ds la zone format lui dire que c'est du vrai/faux et
surtout en liste choix préciser "case à cocher" tjs en VB bien sûr

Merci


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

Avatar
Patrice
Merci beaucoup


re,

Quelque chose comme :

Sub zz()
' Charger Microsoft DAO 3.x Object Library
'CurrentDb.Execute "Alter table LaTable alter column LeChamp bit"
Dim bd As DAO.Database
Dim t As DAO.TableDef
Dim f As Field, prp As DAO.Property
Set bd = CurrentDb
Set t = bd.TableDefs("LaTable")
Set f = t.Fields("LeChamp")
f.Properties("DisplayControl") = acCheckBox
Set prp = f.CreateProperty("Format", dbText, "True/False")
f.Properties.Append prp
Set prp = Nothing
Set f = Nothing
Set t = Nothing
bd.Close
Set bd = Nothing
DoCmd.OpenTable "LaTable", acViewDesign ' pour voir la case à cocher
End Sub


bonjour,

Je modifie par VB, un champ text en champ boolean comme suit :

CurrentDb.Execute "ALTER TABLE application ALTER COLUMN [" & nom du champ &
"] bit"

comment faire pour ds la zone format lui dire que c'est du vrai/faux et
surtout en liste choix préciser "case à cocher" tjs en VB bien sûr

Merci


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