Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Adox default value for column

Posted on 2003-02-27
Medium Priority
Last Modified: 2008-03-03
I am using ADOX (on Windows 2000) to create a new table in my database.

One of the columns must have a default for each new record so I wish to
populate the default dynamic property.

However, I cannot do this because when I try to set the value of the
default property I am told the data type is wrong (it is expecting

Set adoxCatalog.ActiveConnection = ADOCon
Set adoxTable = New adox.Table
adoxTable.Name = "MyNewTable"

Set adoxCol = New adox.Column
Set adoxCol.ParentCatalog = adoxCatalog
adoxCol.Name = "MyNewColumn"
adoxCol.Type = adInteger
adoxCol.Attributes = adColFixed
adoxCol.Properties("Default").Value = 0   ' this line fails
adoxTable.Columns.Append adoxCol

Question by:Victoria_
1 Comment

Accepted Solution

QJohnson earned 300 total points
ID: 8034888
Only two things come to mind. First, try:

adoxCol.Properties("Default").Value = CVar(0)

since the default property is supposed to expect a variant and perhaps it has a hard time with literal integer.

On the second issue, I may be off-base, but I thought the adColFixed attribute was only for use on character fields whose width can vary.  Since you have an integer field here, perhaps you should just try commenting that line out.

What version of ADOX are you using?  I never got the data type error complaint until I executed the cat.Tables.Append statement - and then had to visit the data type of every column to try and figure out which one caused the problem.  This is pretty nice if it has changed and can actually show you the offending one now.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question