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

Article translations Article translations
Article ID: 279245 - View products that this article applies to.
This article was previously published under Q279245
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

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.

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.

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.

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.

Properties

Article ID: 279245 - Last Review: February 28, 2014 - Revision: 3.3
APPLIES TO
  • Microsoft Data Access Components 2.5 Service Pack 1
  • Microsoft Data Access Components 2.5
  • Microsoft OLE DB Provider for Jet 4.0
Keywords: 
kbnosurvey kbarchive kbbug kbfix kbmdacnosweep KB279245

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com