Solved

Access 2007 How do you add a checkbox in query

Posted on 2011-02-28
3
613 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
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
is Microsoft Access going to Die? 9 55
aggregate query? 20 53
SetFocus doesn't wait for input 14 34
Switch 5 18
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

831 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