How to make NEW .mdb file programmically in VB... 
Author Message
 How to make NEW .mdb file programmically in VB...

Hi there,

    I am going to write a VB program that will prompt the user for the
filename (Access 2000 .mdb file) and then create a new empty .mdb file, and
then create some Tables in it, and then the fields in each table...
    So, my question is... is there possible to make a whole new .mdb file
(with new tables and new fields) from "nothing", using ADO and/or even some
SQL statements in VB?

Thanks for any advise.



Mon, 25 Oct 2004 18:27:13 GMT  
 How to make NEW .mdb file programmically in VB...
Make a reference in your project to the Jet Replication library and use the
jetEngine.CreateDatabase method.

--
Michael Collier Bsc (Hons)
Interactive ADO Object Browser
www.adoanywhere.com

--


Quote:
> Hi there,

>     I am going to write a VB program that will prompt the user for the
> filename (Access 2000 .mdb file) and then create a new empty .mdb file,
and
> then create some Tables in it, and then the fields in each table...
>     So, my question is... is there possible to make a whole new .mdb file
> (with new tables and new fields) from "nothing", using ADO and/or even
some
> SQL statements in VB?

> Thanks for any advise.



Tue, 26 Oct 2004 06:34:34 GMT  
 How to make NEW .mdb file programmically in VB...
Hm... I can find the "Microsoft Jet and Replication Objects 2.1 Library"
in the References dialog, but in the JetEngine object, I can only see 2
methods - CompactDatabase and RefreshCache, I can't see the
CreateDatabase method...
Is this library the same as you mentioned before? Or my library version
is too old? (I am using VB6 SP5...)

Thanks in advance...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 26 Oct 2004 15:48:02 GMT  
 How to make NEW .mdb file programmically in VB...
Your right. Jet has two methods CompactDatabase and RefreshCache...I was
sure I had used JET to create blank databases..If I did then it would have
been by using CompactDatabase method and specifying a blank source..clever
perhaps but I cannot for the life of me remember it.

ADOX is definitely the library you are after for creating blank mdb files.
coCatalog.create
Limitations:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q271483

Sorry for confusion!!

--
Michael Collier Bsc (Hons)
Interactive ADO Object Browser
www.adoanywhere.com

--


Quote:
> Hm... I can find the "Microsoft Jet and Replication Objects 2.1 Library"
> in the References dialog, but in the JetEngine object, I can only see 2
> methods - CompactDatabase and RefreshCache, I can't see the
> CreateDatabase method...
> Is this library the same as you mentioned before? Or my library version
> is too old? (I am using VB6 SP5...)

> Thanks in advance...

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 26 Oct 2004 21:36:30 GMT  
 How to make NEW .mdb file programmically in VB...
Here is how to do it with the ADOX object

    Dim cat As New ADOX.Catalog
    cat.Create
Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\datapath\dat
afile.mdb

Quote:
>-----Original Message-----
>Your right. Jet has two methods CompactDatabase and

RefreshCache...I was
Quote:
>sure I had used JET to create blank databases..If I did
then it would have
>been by using CompactDatabase method and specifying a

blank source..clever
Quote:
>perhaps but I cannot for the life of me remember it.

>ADOX is definitely the library you are after for creating
blank mdb files.
>coCatalog.create
>Limitations:
>http://support.microsoft.com/default.aspx?scid=kb;EN-
US;Q271483

>Sorry for confusion!!

>--
>Michael Collier Bsc (Hons)
>Interactive ADO Object Browser
>www.adoanywhere.com

>--



>> Hm... I can find the "Microsoft Jet and Replication

Objects 2.1 Library"

- Show quoted text -

Quote:
>> in the References dialog, but in the JetEngine object,
I can only see 2
>> methods - CompactDatabase and RefreshCache, I can't see
the
>> CreateDatabase method...
>> Is this library the same as you mentioned before? Or my
library version
>> is too old? (I am using VB6 SP5...)

>> Thanks in advance...

>> *** Sent via Developersdex http://www.developersdex.com
***
>> Don't just participate in USENET...get rewarded for it!

>.



Sat, 18 Dec 2004 07:28:13 GMT  
 How to make NEW .mdb file programmically in VB...

Dear Mr Pig,

You do it with ADOX. Would you care for a code sample that shows how to
create the database and all the tables, fields, indexes, etc in code?

Cecil


Quote:
> Hi there,

>     I am going to write a VB program that will prompt the user for the
> filename (Access 2000 .mdb file) and then create a new empty .mdb file,
and
> then create some Tables in it, and then the fields in each table...
>     So, my question is... is there possible to make a whole new .mdb file
> (with new tables and new fields) from "nothing", using ADO and/or even
some
> SQL statements in VB?

> Thanks for any advise.



Sun, 19 Dec 2004 06:24:31 GMT  
 How to make NEW .mdb file programmically in VB...
Hi,

There are some KBs about that

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q275252

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q275249

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q304323

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q297980

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q230588

http://www.able-consulting.com/ADOX_Faq.htm#Q2

--
Val Mazur
Microsoft MVP


Quote:

> Dear Mr Pig,

> You do it with ADOX. Would you care for a code sample that shows how to
> create the database and all the tables, fields, indexes, etc in code?

> Cecil



> > Hi there,

> >     I am going to write a VB program that will prompt the user for the
> > filename (Access 2000 .mdb file) and then create a new empty .mdb file,
> and
> > then create some Tables in it, and then the fields in each table...
> >     So, my question is... is there possible to make a whole new .mdb
file
> > (with new tables and new fields) from "nothing", using ADO and/or even
> some
> > SQL statements in VB?

> > Thanks for any advise.



Sun, 19 Dec 2004 19:20:06 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Making an mdb file an EXE file

2. Making .EXE file From .MDB files

3. programmically making listbar in ListBox Flat or 3D

4. How to create new mdb file using VB

5. VB making new VB EXE

6. Export data from mdb to a new mdb with ADO

7. Concatinate .mdb files into single .mdb file

8. How can I copy an mdb file to a new directory

9. Creating a new MDB file with code.

10. Access XP Report To PDF - VB Set Filename programmically

11. How can i programmically Set Location of my database in Crystal Report of vb.net

12. Using mdb reference is allowed only from mdb file

 

 
Powered by phpBB® Forum Software