Create a new mdb (Access Database) from the code in Visual Basic (visual studio express)

Hi.

I  am writing a vb application that needs to be able to work from several access databases.  The data bases will be essentially the same just different accounts so to speak.

This means I will need to be able to create a new blank database from  the code if the user chooses to add another account.   How would I do this?  I'm a bit new to visual studio so take it slow.

It doesn't have to be an access database. that's just what i'm used to working with.

Best regards
LVL 4
rowanscottAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Why don't you have a template (empty database) and just make a copy when required?
0
rowanscottAuthor Commented:
That's a good idea.  Do you know how to make a copy with vb code or how to include the template with the installer.
0
Jorge PaulinoIT Pro/DeveloperCommented:
In the installer you can include the database and for copy you just need to do IO.File.Copy(sourceFile,destFile)
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rowanscottAuthor Commented:
Do I make the mdb database manually first using Microsoft Access.  Sorry I'm very new to visual studio.  I have done lots of vba in excel though so I'm hoping I will pick it up before too long.
0
Jorge PaulinoIT Pro/DeveloperCommented:
>> Do I make the mdb database manually first using Microsoft Access
Yes, it's the easy way! :)
0
rowanscottAuthor Commented:
OK.

I know how to use an mdb from excel's vba but i'm sure there would be a better way in visual studio.

Can you give me any clues.
0
rowanscottAuthor Commented:
I'm not getting this.  I've made the mdb database and embedded it.  

I cant even work out how to read and write to an embedded text file yet.  How do you refer to text files (i will get onto the database later) if they are embedded because you don't know their full address.

Sorry to be so slow!

0
Jorge PaulinoIT Pro/DeveloperCommented:
>> I've made the mdb database and embedded it.
You have embedded it? In the resources?
If so you need to extract for a specific location. Check this blog post http://vbtuga.blogspot.com/2009/04/vbnet-extraindo-executaveis-dos.html
It's in Portuguese (it's my blog) but I think you understand the code. You can extract the db to a place you define and then work with her.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rowanscottAuthor Commented:
Yippee, thanks jpaulino

Now I can just make copies of the database whenever the user wants to add an account.

I still need to keep a record of what accounts have been added which I thought to do in an "Accounts.txt" file in the resources but your help has solved my original question.

I've used your function so I'm proud to have some resident Portuguese comments in my application now!

 
0
rowanscottAuthor Commented:
Thanks very much.
0
Jorge PaulinoIT Pro/DeveloperCommented:
Glad I could help and I think the Portuguese comments will look nice on your application :)
Cheers!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.