Access 2007 How do you add a checkbox in query

I need to add a  new Yes\no box in a make table query with a value 0.  How do I do that?
glomo82Asked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

this sub will create the yesno field as check box


sub addYesNoField()
Dim p As DAO.Property, db As DAO.Database
Set db = CurrentDb
With db.TableDefs("tableX")
    .Fields.Append .CreateField("MyYesNo", dbBoolean)
    Set p = .Fields("MyYesNo").CreateProperty("displaycontrol", dbInteger, 106)
    .Fields("MyYesNo").Properties.Append p
End With
end sub


change tablex and MyYesNo feild with actual names


0
 
kpltechgroupCommented:
0
 
Rey Obrero (Capricorn1)Commented:
you can't do that in a make table query.
after running your make table query (without the yesNo field), run this codes



sub addYesNoField()
Dim p As DAO.Property, db As DAO.Database
Set db = CurrentDb
With db.TableDefs("tableX")
    .Fields.Append .CreateField("MyYesNo", dbBoolean)
    Set p = .Fields("MyYesNo").CreateProperty("displaycontrol", dbInteger, 106)
    .Fields("MyYesNo").Properties.Append p
End With
0
All Courses

From novice to tech pro — start learning today.