"Savante" <gr***********@savante.co.ukwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>I am trying to investigate the JET databases to enable me to save data
from a datalogging program I'm writing.
At the moment, I've been using tutorial 21 of the SAMS "Learn it in 24
hours book". Whilst the book has been useful in terms of adding and
editing records from an already existing database file, I want to be
able to make my own database file at runtime.
My databasing program can create an unknown number of columns and I
therefore want to be able to press a save button and store all my data
in one go.
Anyone had experience at this-how do I create a database file?
Best Regards,
Grant
Here is some code stripped from an earlier post that may be helpful to you,
alleged to work by the recipient:
Below is working example (semicolon added):
Module Module1
Sub Main()
CreateDb("E:\My folder\My data.mdb")
End Sub
Public Function CreateDb(ByVal path As String)
Dim adox As Object
adox = CreateObject("ADOX.Catalog")
adox.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source=" + path + _
";Jet OLEDB:Engine Type=5;")
End Function
End Module
In that same thread, somebody else suggested a utility here:
Here is a nifty little utility that allows you to point to an Access
database, then it generates VB.Net code to duplicate that database:
http://www.smithvoice.com/dbcopier.aspx