|
Subject:
|
Registering checked checkboxes in a database
|
|
Posted By:
|
KeviJay
|
Post Date:
|
5/14/2008 12:02:42 PM
|
Hi There folks, I have probably an easy question for ya, I am trying to build a database in VB.net with some success however i'm getting really stuck on one issue. I have a list of checkboxes which will be checked whenever a brochure is sent or requested, this works fine until i try to query wither or not the checkboxes has been checked. I keep getting a data type mismatch error. In access i simply set the filter on sent brochure to yes and that gave me the results. I have been reading as much as possible on this and am getting no where i have found some articles that mention that checkboxes get stored in a 1/0 format and tried this to but no success. I need help in coding that if a checkbox is checked on the form 1st it hets stored in the table and second how to build a query to retive wither or not the sent checkbox has been checked.
|
|
Reply By:
|
gbianchi
|
Reply Date:
|
5/14/2008 12:11:50 PM
|
Checkboxes work in 1/0, but access works booleans in -1/0. Since the 0 is false in both cases, the best you can do is checkbox.value * -1 always, and you will get the rigth value inserted in the database, and the same when you recover your data. For the query, you can still use true/false to get your data, or -1/0, whatever you like more...
HTH
Gonzalo
=========================================================== Read this if you want to know how to get a correct reply for your question: http://www.catb.org/~esr/faqs/smart-questions.html ^^Took that from dparsons signature and he Took that from planoie's profile =========================================================== My programs achieved a new certification (can you say the same?): WORKS ON MY MACHINE http://www.codinghorror.com/blog/archives/000818.html =========================================================== I know that CVS was evil, and now i got the proof: http://worsethanfailure.com/Articles/Classics-Week-I-Hate-You.aspx ===========================================================
|
|
Reply By:
|
KeviJay
|
Reply Date:
|
5/14/2008 12:41:36 PM
|
Hi gbianchi, Thanks mate for responding however i am unsure what you mean, I know my ignorance must astound you when i try the query
SELECT ContactID, OrganisationName, ContactType, Title, Gender, FirstName, LastName, Address1, Address2, Address3, Address4, Address5, Address6, [E-mail], [Phone#], [Mobile#], DateOfBirth, [Interest Area], [Interest Area2], [Interest Area3], [Interest Area4], [Interest Area5], SummerBrochureReq, PTProspectusReq, FTProspectusReq, LeafletReq, PTbrochureReq, PosterA3Req, PosterA4Req, FlierReq, OtherReq, PTProspectusSent, FTProspectusSent, SummerBrochureSent, LeafletSent, PTbrochureSent, PosterA3Sent, PosterA4Sent, FlierSent, OtherSent, OtherCourses, DateSent, [Date()] FROM [tblStudents&Organisations] Where SummerBrochureSent=-1
I get no results at all and if i try with 0 i get all the records that are store irrespective of wither or not there checkboxes are checked or no, also true/false yes/no here always throws up the previous message
|
|
Reply By:
|
gbianchi
|
Reply Date:
|
5/14/2008 1:05:35 PM
|
If you get all the records with 0, then you are not storing changes into the database when you check or uncheck the checkboxes...
HTH
Gonzalo
=========================================================== Read this if you want to know how to get a correct reply for your question: http://www.catb.org/~esr/faqs/smart-questions.html ^^Took that from dparsons signature and he Took that from planoie's profile =========================================================== My programs achieved a new certification (can you say the same?): WORKS ON MY MACHINE http://www.codinghorror.com/blog/archives/000818.html =========================================================== I know that CVS was evil, and now i got the proof: http://worsethanfailure.com/Articles/Classics-Week-I-Hate-You.aspx ===========================================================
|
|
Reply By:
|
KeviJay
|
Reply Date:
|
5/14/2008 4:44:45 PM
|
Thanks again friend, of course you are correct its seems that i am making changes that will show when the forms are loaded but not updating the database, Think i need to go back and look over the basics again. But thank you for ur response :)
|