By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,015 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,015 IT Pros & Developers. It's quick & easy.

Need help: Create Access Database programmatically using VB .NET

P: n/a
Hello, i am using ADOX + VB .NET to create a Access Database
programmatically. I plan to set some properties of the column such primary
key.
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
<11"
..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
Share this Question
Share on Google+
1 Reply


P: n/a
Sunlight,

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

microsoft.public.data.ado

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

Cor
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.