Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Display Control with code

Status
Not open for further replies.

thefox149

Technical User
Nov 22, 2004
158
AU
guys my synatx is wrong here any help??

my code adds a yes/no field but i wanna set the field display control to be a check box

'Adds tag
straddcolumn = "ALTER TABLE COLDATA ADD COLUMN tag Bit;"
DoCmd.RunSQL straddcolumn

'makes the display control a check box
Set db = CurrentDb
Set tdf = db.TableDefs("COLDATA")
Set fld = tdf.Fields("tag")
Set prp = fld.CreateProperty("Display Control", "Check Box")
 
Is It...

Set prp = fld.CreateProperty("Display Control", dbBoolean)??
 
have used this

Set db = CurrentDb
Set tdf = db.TableDefs("COLDATA")
Set fld = tdf.Fields("tag")
Set prp = fld.CreateProperty("Display Control", dbBoolean)
fld.Properties.Append prp


but gives me "property value must be set before using this method"

 
any help guys??

have tried different variances of this can anyone find this info on the msdn?
 
Is it not the CreateControl Action you want?

Set ctl = CreateControl(frm.Name,acCheckBox, , "", "",
 
it is usual set in the table lookup tab

the form that does use the field is an unbound form
with it's source property set to a query..(which shows the present the data)
 
What error were you getting the first time?
 
fld.CreateProperty("DisplayControl", 3,106)
 
You may want to do
fld.CreateProperty("Format",10,Yes/No)
as well

Dim dbs As Database, tdf As TableDef
Dim fld As Field, prp As Property

Set dbs = CurrentDb
Set tdf = dbs.TableDefs!tablename
Set fld = tdf.CreateField("fieldname", dbBoolean)
tdf.Fields.Append fld
Set prp = fld.CreateProperty("DisplayControl", 3, 106)
fld.Properties.Append prp
Set prp = fld.CreateProperty("Format", 10, "Yes/No")
fld.Properties.Append prp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top