Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Add a Display Control (Checkbox, Combobox) to a YesNo Field
From Wiki
If you create a table with SQL, your YesNo fields will not be formatted. This may not bother you, but if it does, you will need to use DAO to add a format.
- Sub AddDisplayControl()
- 'Requires reference to Microsoft DAO 3.6 Object Library
- Dim tdf As DAO.TableDef
- Dim fld As DAO.Field
- Dim db As Database
- Dim strSQL As String
- Set db = CurrentDb
- 'Create a table ...
- strSQL = "Create Table tblLTD (TheYesNoCheck YesNo, TheYesNoCombo YesNo)"
- db.Execute strSQL
- 'It is now in the table collection, so ...
- Set tdf = db.TableDefs("tblLTD")
- 'Change the way the YesNo fields display.
- 'A Checkbox
- Set fld = tdf.Fields("TheYesNoCheck")
- Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
- fld.Properties.Append prp
- 'A combobox
- Set fld = tdf.Fields("TheYesNoCombo")
- Set prp = fld.CreateProperty("DisplayControl", dbInteger, acComboBox)
- fld.Properties.Append prp
- 'We will need a format
- Set prp = fld.CreateProperty("Format", dbText, "Yes/No")
- fld.Properties.Append prp
- End Sub



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.