Trying to Create an Access DB File

W

Wayne Wengert

I am trying to create an Access 2000 database using VB.NET. I found the code
below via a google search but when I run it I always get an error.
I do have a reference to Microsoft ADO Ext. 2.7 for DDL and Security. The
path and file name are valid. Any thoughts on how to debug this?

If I use the Command window to try to find out what the error is I get
messages like this
?Excep.ErrorCode

'Excep.ErrorCode' is not declared or the module containing it is not loaded
in the debugging session.

==================== Code ====================

Public Function CreateAccessDatabase(ByVal DatabaseFullPath As String) As
Boolean

Dim bAns As Boolean

Dim cat As New ADOX.Catalog

Try



Dim sCreateString As String

sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
DatabaseFullPath

cat.Create(sCreateString)

bAns = True

Catch Excep As System.Runtime.InteropServices.COMException

bAns = False



Finally

cat = Nothing

End Try

Return bAns

End Function
 
C

Cor Ligthert

Wayne,

I see not direct errrors, I thought that it is the same as the code I use
what is beneath. .

set a reference to COM adox ext 2.x for dll and security
\\\
Dim catNewDB As New ADOX.Catalog
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=C:\db1.mdb")
///
I hope this helps a little bit?

Cor
 
W

Wayne Wengert

Thanks for the response Cor. It is interesting that this morning my routine
seems to work but your code triggers an error that installable ISAM could
not be found? Life is never dull, eh?

Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top