Click to See Complete Forum and Search --> : checkbox help


swofford
03-16-2006, 02:13 PM
Hi all,

My client has an Access database where the value of a checkbox is stored in a field called Exclude_PropCount as -1 or 0. I am trying to get this form working online, but have been unable to successfully store this value in the db. I have set up a simple page to test it, and my relevant code is this:

sql_save = "INSERT INTO HVM_Data (VC, Exclude_PropCount) VALUES ('a9', '-1')"

con.Execute sql_save

set duplicateVC1 = db.Execute("SELECT Exclude_PropCount FROM HVM_Data WHERE VC = 'a9'")

response.write duplicateVC1("Exclude_PropCount")

But no matter whether I have '-1' or '0' in the INSERT statement, the response.write line always returns "False". And of course I've tried inserting "true" and "false", but it only accepts an integer.

As exceptionally bad timing would have it, my server is slightly fubar and I can't download the database to my PC to see what's actually being stored there, but looking at the above code, do you see anything I'm doing inherently *wrong*? This is my first time with checkboxes so I won't be surprised if that's the case. Hints?

I should add that I do have an older copy of the db on my desktop, and there is already a record that does have '-1' in the Exclude_PropCount field, and it *does* return "True". So when I do:

set duplicateVC2 = db.Execute("SELECT Exclude_PropCount FROM HVM_Data WHERE VC = 'HKX'")

response.write duplicateVC2("Exclude_PropCount")

Then the response.write returns "True". All other records have zeroes and return "False". I just can't download the updated db to see what value is going in for VC='a9'. My suspicion is that someone less tired than I could look at my code and show me where I'm being a dummy.

Thanks!

chrismartz
03-16-2006, 05:06 PM
I suggest getting rid of the '-1' and just using either a '1' or a '0'. What data-type is the 'Exclude_PropCount' column?

Ubik
03-16-2006, 05:06 PM
What happens when you do:

sql_save = "INSERT INTO HVM_Data (VC, Exclude_PropCount) VALUES ('a9', TRUE)"

or

sql_save = "INSERT INTO HVM_Data (VC, Exclude_PropCount) VALUES ('a9', -1)" 'no quotes around bool value

swofford
03-16-2006, 06:19 PM
What happens when you do:

sql_save = "INSERT INTO HVM_Data (VC, Exclude_PropCount) VALUES ('a9', TRUE)"

or

sql_save = "INSERT INTO HVM_Data (VC, Exclude_PropCount) VALUES ('a9', -1)" 'no quotes around bool value

Well, duh, it WORKS when I do that. ;) No, seriously ... removing the quotes from 'True' (as I tried previously *with* quotes) worked wonders. Geez, you guys always help me in huge ways.

To answer chrismartz's question, the datatype for Exclude_PropCount is Yes/No. (Yet when I look in the table it's all 0's and -1's ... and here entering True and False work ... so confusing.)

Thank you!