Microsoft Knowledge Base Email Alertz

(221184) - When inserting data into a Bit (Yes/No) field in a Microsoft Access database via the Microsoft Access ODBC driver, the resulting data in the bit field is always False, even when a value of True was specified. This behavior occurs when using the...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 221184 - Last Review: May 17, 2007 - Revision: 3.5

FIX: Access Bit Fields and MDAC 2.1

This article was previously published under Q221184

On This Page

SYMPTOMS

When inserting data into a Bit (Yes/No) field in a Microsoft Access database via the Microsoft Access ODBC driver, the resulting data in the bit field is always False, even when a value of True was specified.

This behavior occurs when using the Microsoft Access/Jet ODBC driver provided with MDAC 2.1, version 4.0.3513, and MDAC 2.1 SP1, version 4.0.3711.

CAUSE

The Microsoft Access ODBC driver (Odbcjt32.dll) is incorrectly using 2 bytes rather than a single byte when calculating the offset to the data for the bit field. This offset does not contain the correct value, and the data is inserted into the database as False.

STATUS

This problem has been resolved in the Microsoft Access ODBC/Jet Driver provided with Microsoft Data Access Components 2.1 Service Pack 2 and later.

You may download the latest Microsoft Data Access Components service pack from the following site:
http://msdn2.microsoft.com/en-us/data/aa937695.aspx (http://msdn2.microsoft.com/en-us/data/aa937695.aspx)
Alternatively, you may acquire the hotfix version of the Microsoft Access ODBC driver that addresses this problem for earlier versions of Microsoft Data Access Components 2.1. A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.




The English version of this fix should have the following file attributes or later:

  Date      Time   Version      Size   File name   Platform
  ---------------------------------------------------------
  03/18/99         4.0.3918.0   301KB  Odbcjt32.dll        

				


This hotfix is engineered to work with Microsoft Data Access Components (MDAC) build 2.1.


Installation instructions:
  1. Locate Odbcjt32.dll in the system folder.
  2. Verify that no applications or services are using the driver, then rename the driver.
  3. Acquire the hotfix version of the driver.
  4. Copy the new driver into the system folder.

MORE INFORMATION

Steps to Reproduce Behavior

The code sample below uses RDO to demonstrate the behavior described above. After the code has run, notice that the values in the TrueFalse table have been set to False despite True being specified.


    Dim szSQL$
    Dim rdorst As rdoResultset
    Dim mrdoEnv As rdoEnvironment
    Dim mrdoConn As rdoConnection
    Dim mbConnOpen As Boolean

   'Initialize the Environment.
    rdoEngine.rdoDefaultCursorDriver = rdUseServer
    Set mrdoEnv = rdoEngine.rdoCreateEnvironment("TrueFalseTest", "", "")
    mrdoEnv.UserName = "admin"
    
   
    Set mrdoConn = mrdoEnv.OpenConnection(DSName:="Northwind", Prompt:=rdDriverComplete, _
                                           ReadOnly:=False, Connect:="pwd=;")
        
    
    mrdoConn.QueryTimeout = 60
    mbConnOpen = True
   
    
    szSQL = "Create table TrueFalse(Check1 bit, Check2 bit)"
    mrdoConn.Execute szSQL
        
        
    szSQL = "SELECT * FROM TrueFalse"
    Set rdorst = mrdoConn.OpenResultset(szSQL, rdOpenKeyset, rdConcurRowVer)

    rdorst.AddNew

    rdorst!Check1 = True
    rdorst!Check2 = True
    
    rdorst.Update
    rdorst.Close
				

APPLIES TO
  • Microsoft Data Access Components Software Development Kit 2.1
  • Microsoft Data Access Components 2.5
Keywords: 
kbhotfixserver kbqfe kbbug kbdatabase kbdriver kbfix kbjet kbmdacnosweep kbodbc210fix kbrdo KB221184
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate