Default value in checkbox changes when entering new line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gurge
    New Member
    • Mar 2008
    • 4

    #1

    Default value in checkbox changes when entering new line

    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!! :)
  • PianoMan64
    Recognized Expert Contributor
    • Jan 2008
    • 374

    #2
    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.

    Comment

    • gurge
      New Member
      • Mar 2008
      • 4

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

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        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?

        Comment

        • gurge
          New Member
          • Mar 2008
          • 4

          #5
          Hi all...

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



          after a hotfix, it works fine now.

          Thanks alot for all the help ;)
          Last edited by Stewart Ross; Mar 28 '08, 07:59 AM. Reason: hyperlinked reference

          Comment

          • Fiddler2
            New Member
            • Mar 2008
            • 19

            #6
            Originally posted by gurge

            Hey, your link didn't work and I'm really curious about this. Would you mind explaining the gist of it?

            Comment

            • gurge
              New Member
              • Mar 2008
              • 4

              #7
              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...

              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.publi c.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/474a73bca0883a1 5/cfe98fa5112528f a?lnk=st&q=acce ss+sp3+adp+bit& rnum=9

              Thanks
              ToniS
              Answer

              Toni,
              Description of the Access 2003 post-Service Pack 3 hotfix package:
              December 18, 2007

              Jeanette Cunningham
              Its basically due to the combi of having Office 03 and SP3. and Microsoft has recognised this problem:

              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; Mar 28 '08, 08:15 AM. Reason: split URL in quotes into half, was elongating the page

              Comment

              Working...