Solved

Access 2007 How do you add a checkbox in query

Posted on 2011-02-28
3
617 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Expert Comment

by:kpltechgroup
ID: 35003786
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35003843
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 35003859

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 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