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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yes/No Format in Table design 1

Status
Not open for further replies.

nadjib

Programmer
May 14, 2003
23
0
0
CA
Hi,
In table design view i have a field that is a Yes/No.
In it's details the Format is Yes/No.
It's default value is No
In datasheet view this field is a checkbox (unticked of course)

I have written code to create a Table im my database. It Ok. However hard i try, however much reading i have done, I cant make the field a check box !!!!!

I've done the
createfield("name", dbBoolean)

What am i missing here ????

In database design i can do this in a couple of clicks.
I've spent a day on it trying to code it and i'm no closer.

Thanx
nadjib
 
Hi nadjib,

The property you need to set is DisplayControl; it won't exist for a new field, so you'll also have to create it:

Code:
[blue]Dim db As DAO.Database
Dim fld As DAO.Field
Dim prop As DAO.Property

Set db = CurrentDb
Set fld = db.TableDefs![i]YourTable[/i].Fields![i]YourNewYesNoField[/i]

Set prop = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
fld.Properties.Append prop

Set prop = Nothing
Set fld = Nothing
Set db = Nothing[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Hi Tony and thanks for your assistance

I'm Wonder, because it work,

So I send you thousand of thanks

Have a nice day
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top