VB6 DAO & MS Access

H

holdemfoldem

I'm trying to build new tables in existing databases in MS Access 2003, using
VB6 SP6 on an XP box.

It's working pretty well, except for creating fields of type "Yes/No".

Here's some sample code (I left out the variable declarations and code for
opening the table, creating the table, careting other fields in the table,etc,
since that's all working fine):

Dim ZoneFieldDef As DAO.Field
 
H

holdemfoldem via AccessMonster.com

Thanks $10000000000000000000000, Douglas!!!

One more important question: When I view the table in design mode, the
fields are clearly of the correct, "Yes/No" type, BUT, when I view the table
in edit mode, instead of the customary check boxes, each field looks like a
simple text field, ready for input.

Do you know why this is?

Thanks - and please stay with me, I'm really close here!
So-called "Yes/No" fields have a type of dbBoolean.
I'm trying to build new tables in existing databases in MS Access 2003,
using
[quoted text clipped - 8 lines]
Dim ZoneFieldDef As DAO.Field
 
D

Douglas J. Steele

Open the table in design view, and look at the DisplayControl property of
the field (on the Lookup tab in the bottom left-hand corner)

Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim prp As DAO.Property

Set dbs = CurrentDb()
Set tdf = dbs.TableDefs("CheckBoxes")
Set fld = tdf.Fields("BooleanField")
' 106 is CheckBox, 109 is TextBox, 111 is ComboBox
Set prp = fld.CreateProperty("DisplayControl", dbLong, 106)
fld.Properties.Append prp

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


holdemfoldem via AccessMonster.com said:
Thanks $10000000000000000000000, Douglas!!!

One more important question: When I view the table in design mode, the
fields are clearly of the correct, "Yes/No" type, BUT, when I view the
table
in edit mode, instead of the customary check boxes, each field looks like
a
simple text field, ready for input.

Do you know why this is?

Thanks - and please stay with me, I'm really close here!
So-called "Yes/No" fields have a type of dbBoolean.
I'm trying to build new tables in existing databases in MS Access 2003,
using
[quoted text clipped - 8 lines]
Dim ZoneFieldDef As DAO.Field
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top