Connecting Tech Pros Worldwide Help | Site Map

Default value in checkbox changes when entering new line

Newbie
 
Join Date: Mar 2008
Posts: 4
#1: Mar 20 '08
Hello!

I have a form in datasheet view with checkboxes. One of them is called Cancelled. In the SQL table it is a bit value.

When a user keys in a line, the checkbox should be default unchecked unless he/she checks it.

So what I have done is to set the default value to False (have tried 0 as well)
and in the bottom row (the add new line row) this box is shown to be unchecked.

But once I key in any data in the row, the checkbox immediately auto checks itself.

Any idea what I need to check to find the source of this problem??

Appreciate any help!! :)
Expert
 
Join Date: Jan 2008
Posts: 365
#2: Mar 20 '08

re: Default value in checkbox changes when entering new line


I'm assuming from what you've wrote that since you've mentioned the SQL Word, that you're either using MS SQL or some other SQL Backend other than MS Access? If that is true. you need to change the table definition to Integer with a value of 0 for false and -1 for the value of true. anything else will always evaluate to true. This is why you're getting the checked box, because access is evaluating the value in the Bit field as true. Just change the field type from Bit to Integer and change the value to 0 for false.
Newbie
 
Join Date: Mar 2008
Posts: 4
#3: Mar 26 '08

re: Default value in checkbox changes when entering new line


Hi!

Sorry for the late reply... Just managed to get back on this task again.
I totally understand what you mean and thank you for explaining it to me. Yes, I am using MS SQL.

I tried doing what you said and changed that column from bit to smallint (am i right?) however, I dont know how to default 0 to false as you said (I am using MS SQL Management Studio) Or is it done using SQL code?

appreciate the help! thanks ;)
FishVal's Avatar
Expert
 
Join Date: Jun 2007
Location: Israel
Posts: 2,584
#4: Mar 26 '08

re: Default value in checkbox changes when entering new line


Quote:

Originally Posted by gurge

......
So what I have done is to set the default value to False (have tried 0 as well)
and in the bottom row (the add new line row) this box is shown to be unchecked.

But once I key in any data in the row, the checkbox immediately auto checks itself.
......

Are you sure there is no code running on Current event in the form?
Newbie
 
Join Date: Mar 2008
Posts: 4
#5: Mar 28 '08

re: Default value in checkbox changes when entering new line


Hi all...

Seems after a TON of googling, my issue was exactly this:

http://thesource.ofallevil.com/commu...r=US&sloc=&p=1

after a hotfix, it works fine now.

Thanks alot for all the help ;)
Newbie
 
Join Date: Mar 2008
Location: Portland, Oregon
Posts: 19
#6: Mar 28 '08

re: Default value in checkbox changes when entering new line


Quote:

Originally Posted by gurge

Hi all...

Seems after a TON of googling, my issue was exactly this:

http://thesource.ofallevil.com/commu...r=US&sloc=&p=1

after a hotfix, it works fine now.

Thanks alot for all the help ;)


Hey, your link didn't work and I'm really curious about this. Would you mind explaining the gist of it?
Newbie
 
Join Date: Mar 2008
Posts: 4
#7: Mar 28 '08

re: Default value in checkbox changes when entering new line


Hmm yea... its kind of a weird URL...(funny as well) the site is actually the microsoft forums tho.

Hope its okay to copy and paste what it said...

Quote:
I have Access 2003 and SQL Server 2000. Lately I noticed when I add a new
record, all of the bit (check box) feilds deault to True instead of False. i
have made sure w/i Enterprise Manager the defualt is 0, I also did this with
in Access, property
field default value to 0. I did some research and one reply on
Microsoft.public.access was that this is a known bug that has been introdued
by 2003 sP3 and MS is aware if this problem. Do you know if this problem has
been fixed? How do I determine that? (I tried looking for a fix) Does anyone
know of a work around?

Below is the website where I found the response. http://groups.google.com/group/micro.../browse_thread
/thread/474a73bca0883a15/cfe98fa5112528fa?lnk=st&q=access+sp3+adp+bit&rnum= 9

Thanks
ToniS
Quote:
Answer

Toni,
Description of the Access 2003 post-Service Pack 3 hotfix package:
December 18, 2007
http://support.microsoft.com/kb/945674
Jeanette Cunningham
Its basically due to the combi of having Office 03 and SP3. and Microsoft has recognised this problem:
http://support.microsoft.com/kb/945674
and created a hotfix for it.

Do let me know asap if its NOT okay to copy the other forum's thread here. :)

Hope this helped anyone!
Reply


Similar Microsoft Access / VBA bytes