Connecting Tech Pros Worldwide Help | Site Map

Default value in checkbox changes when entering new line

  #1  
Old March 20th, 2008, 07:49 AM
Newbie
 
Join Date: Mar 2008
Posts: 4
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!! :)
  #2  
Old March 20th, 2008, 07:53 AM
Expert
 
Join Date: Jan 2008
Posts: 365

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.
  #3  
Old March 26th, 2008, 09:22 AM
Newbie
 
Join Date: Mar 2008
Posts: 4

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 ;)
  #4  
Old March 26th, 2008, 02:10 PM
FishVal's Avatar
Expert
 
Join Date: Jun 2007
Location: Israel
Posts: 2,585
Provided Answers: 8

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?
  #5  
Old March 28th, 2008, 08:21 AM
Newbie
 
Join Date: Mar 2008
Posts: 4

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 ;)

Last edited by Stewart Ross Inverness; March 28th, 2008 at 08:59 AM. Reason: hyperlinked reference
  #6  
Old March 28th, 2008, 09:02 AM
Newbie
 
Join Date: Mar 2008
Location: Portland, Oregon
Posts: 19

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?
  #7  
Old March 28th, 2008, 09:13 AM
Newbie
 
Join Date: Mar 2008
Posts: 4

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!

Last edited by gurge; March 28th, 2008 at 09:15 AM. Reason: split URL in quotes into half, was elongating the page
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Am I Over-Complicating this? sara answers 10 September 5th, 2006 09:35 PM