Solved

Access 2007 How do you add a checkbox in query

Posted on 2011-02-28
3
610 Views
Last Modified: 2012-05-11
I need to add a  new Yes\no box in a make table query with a value 0.  How do I do that?
0
Comment
Question by:glomo82
  • 2
3 Comments
 
LVL 5

Expert Comment

by:kpltechgroup
Comment Utility
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
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
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
Comment Utility

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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now