471,578 Members | 1,262 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,578 software developers and data experts.

Need help: Create Access Database programmatically using VB .NET

Hello, i am using ADOX + VB .NET to create a Access Database
programmatically. I plan to set some properties of the column such primary
The code is as follows:

Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim idx As ADOX.Index
Dim prp As ADOX.Property

Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set tbl = New ADOX.Table

With tbl
..Name = "tblExperimental"
..ParentCatalog = cat
..Columns.Append "CustID", adInteger
..Columns("CustID").Properties("Autoincrement") = True
..Columns("CustID").Properties("Increment") = CLng(3)
..Columns("CustID").Properties("Seed") = CLng(2004000)
..Columns.Append "Name", adVarWChar, 5
..Columns("Name").Properties("Nullable") = True
..Columns.Append "Rating", adInteger
..Columns("Rating").Properties("Description") = "Customer Rating"
..Columns("Rating").Properties("Jet OLEDB:Column Validation Text") = "Must be
between 1 and 10"
..Columns("Rating").Properties("Jet OLEDB:Column Validation Rule") = ">0 and
..Columns("Rating").Properties("Default") = 5
End With

cat.Tables.Append tbl

Set idx = New ADOX.Index

With idx
..Name = "PrimaryKey"
..Columns.Append "CustID"
..PrimaryKey = True
..Unique = True
End With

tbl.Indexes.Append idx

Set idx = Nothing
Set cat = Nothing
when I run the program, it always issue some error: type is invalid.

Can anyone tell me how should I correct my code?
Nov 21 '05 #1
1 3214

Because ADOX has in connection with VBNet a low use, there is probably a
better newsgroup for your question


It has a medium/low activity however I have seen that almost every question
get an answer.

There are people active in that newsgroup who know VBNET.

I hope this helps anyway

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jacob | last post: by
3 posts views Thread by DM | last post: by
16 posts views Thread by peshekeedweller | last post: by
10 posts views Thread by AAaron123 | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.