Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Default Column Properties Cleared When You Set or Check Values by Using ADOX to an Access Database


View products that this article applies to.

This article was previously published under Q279245

↑ Back to the top


Symptoms

When you set or check the default column values for any column in a table that is contained in an Access 2000 database, the default values for the column are cleared.

↑ Back to the top


Resolution

To resolve the problem, install the latest service pack for Microsoft Jet 4.0. Prior to installing the latest Jet 4.0 service pack, Microsoft recommends that you look at the following Microsoft Knowledge Base article for information and issues for downloading:
239114� How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine
For your reference, this article is updated periodically to provide you with the most up-to-date information regarding future Jet service packs.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem can be fixed by installing the latest Jet 4.0 service pack.

↑ Back to the top


More information

Note that there are some issues that you need to be aware of when applying the Jet service pack onto a Windows 2000-based computer. The following white paper titled "The MDAC 2.5 Stack and Windows File Protection" contains a full list of the components that are shipped with MDAC 2.5, along with a discussion of Windows File Protection.

Also refer to this white paper for more information on the Jet dynamic-link libraries (DLLs) that are shipped in MDAC 2.5 and that are no longer a part of MDAC 2.6.

Steps to Reproduce Behavior

  1. Run Microsoft Visual Basic, and create a Standard EXE project. Form1 is created by default.
  2. On the Project menu, click References, and then add references to the following:
    • Microsoft ActiveX Data Objects 2.6 Library
    • Microsoft ADO Ext. 2.6 for DDL and Security

  3. Add a Command button to Form1.
  4. Add the following code to Form1:
    Option Explicit
    
    Private Sub Command1_Click()
        On Error GoTo ErrHandler            'Intercept any errors
    
    Dim strConn         As String           'Work
    Dim strDBPath       As String           'Path for new database
    Dim DBCatalog       As ADOX.Catalog     'ADOX catalog reference
    Dim DBTable         As ADOX.Table       'Database table definition
    Dim DBColumn        As ADOX.Column      'Column object within a table
        
        strDBPath = "C:\TestDB.mdb"         'Path for database
        strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
        
        Set DBCatalog = New ADOX.Catalog    'Database root schema object
        DBCatalog.Create strConn            'Create new database
     
        Set DBTable = New ADOX.Table        'Create a new table object
        DBTable.Name = "TestTable"         'Set name of table
        Set DBTable.ParentCatalog = DBCatalog   'Make Properties collections available
     
        '---Create a column in the table...
        Set DBColumn = New ADOX.Column      'Column object to define
        With DBColumn                       'Reference new column
            .Name = "TestColumn"            'Name the column
            .Type = adInteger               'Type of data
            .DefinedSize = 0                'Normal size of data
            .Attributes = adColFixed        'Column attribute flags
            .NumericScale = 0               'Numeric scaling factor
            .Precision = 10                 'Digits of Precision
        End With                            'Done with DBColumn reference
     
        DBTable.Columns.Append DBColumn     'Add column to table
            
        '---Add new table to the database...
        DBCatalog.Tables.Append DBTable     'Add table to database
        Set DBTable = DBCatalog.Tables("TestTable") 'Reference new table object
        DBTable.Columns("TestColumn").Properties("Default").Value = 5 'Set value for property
        
        Exit Sub
    ErrHandler:
        MsgBox "Error: " & Err.Number & " " & Err.Description
    End Sub
    					
  5. Set strDBPath to a database name to be created.

↑ Back to the top


Keywords: KB279245, kbmdacnosweep, kbfix, kbbug

↑ Back to the top

Article Info
Article ID : 279245
Revision : 6
Created on : 11/25/2003
Published on : 11/25/2003
Exists online : False
Views : 428