I want to create table in MsAccess using command Button in VB 6.0 .
The table should contain the default fields such as Name Text, Roll No Long etc.It should save the name of table with the desired name.
So please post the code here...........

Hi Vikrant,

Frist you need to connect to your Access Database via a connection string.

Once you're there, the easiest way of doing it (since Access seems to have its own interpretation of SQL) you should setup the table in access and have access script its creation (not sure if access supports auto scripting, if not you will need to assemble the SQL through trial and error).

Copy/Paste the script and pass the command over the execute method of your connection.

Hope this helps and good luck!

EDIT: I realized you wanted this functionality to happen with a button click, so just take that code and tie it in with the button_click event :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.