|
-
Jun 16th, 2004, 06:23 AM
#1
Thread Starter
PowerPoster
Quick DB question
ok how do you create a new access Database in a set location useing ADO
and how can you create a new table (using code) using ado and access
and finally how can you view all the tables in a set database 
thanks sorry for all the questions just need to clear something up
PINO
-
Jun 16th, 2004, 07:27 AM
#2
Set references to MS ADO Ext. x.x DDL and Security and run this sample:
VB Code:
Private Sub Command2_Click()
'=============================
Dim tbl As New ADOX.Table
Dim cat As New ADOX.Catalog
Dim sSQL$
sSQL = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\NewDB.mdb;" & _
"Jet OLEDB:Engine Type=5"
cat.Create sSQL
tbl.Name = "Test_Table"
tbl.Columns.Append "Field1", adInteger
tbl.Keys.Append "PrimaryKey", adKeyPrimary, "Field1"
cat.Tables.Append tbl
Set cat = Nothing
Set tbl = Nothing
End Sub
-
Jun 16th, 2004, 08:04 AM
#3
Thread Starter
PowerPoster
when i try and open the created DB it says unrecognized format.....cant i view it visually?
-
Jun 16th, 2004, 08:06 AM
#4
Thread Starter
PowerPoster
and this line errors...
cat.Tables.Append tbl
-
Jun 16th, 2004, 08:35 AM
#5
What version of ADO are you using - you may need 2.6
-
Jun 16th, 2004, 08:36 AM
#6
Thread Starter
PowerPoster
-
Jun 16th, 2004, 10:00 AM
#7
I might be wrong but I think 2.7 is for Access 2002 so get 2.6 from MS - you may have multiple versions installed without any conflict.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|