how to create new table in MS Access2003 database using VB6

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2005
Posts: 7
Reputation: shuvo is an unknown quantity at this point 
Solved Threads: 0
shuvo shuvo is offline Offline
Newbie Poster

how to create new table in MS Access2003 database using VB6

 
0
  #1
Apr 23rd, 2005
I want to create new table in Access database during the runtime of my VB code. I am developing a "Library Management System" using VB6. At first i have used SQL statement to do the job. But it worked for once & then it stopped working. No error message was displayed. I am using "Microsoft ADO
Data Control 6.0 (OLEDB)" to create link with the database & the provider is
"Microsoft Jet 4.0 OLE DB Provider". I am using MS Access2003 to create the
database & VB6 with MSDN installed. I cannot continue the project without removing this problem. Please rescue me!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: how to create new table in MS Access2003 database using VB6

 
0
  #2
Apr 26th, 2005
I'm sure that you will first have to close the database. If you sift around for the methods of the control, there should be one for disconnecting or closing the connection to the database. Another option is to make the control a control array, when you are done with that particular connection, unload the control, and then load a new instance of it in the control array. Here is a link to working with Access Database from VB Code, and may be more beneficial to you:
http://www.timesheetsmts.com/adotutorial.htm
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 3
Reputation: ahmadtamoor is an unknown quantity at this point 
Solved Threads: 1
ahmadtamoor ahmadtamoor is offline Offline
Newbie Poster

Re: how to create new table in MS Access2003 database using VB6

 
1
  #3
May 11th, 2005
First of all you connect to database
then create recordset and attach the SQL Query to Recordsrt
SQL Query "Create Table " Use and open the Recordset you found that the table is created into your database
Read CReate table command in Acces Help
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1
Reputation: aster is an unknown quantity at this point 
Solved Threads: 0
aster aster is offline Offline
Newbie Poster

Re: how to create new table in MS Access2003 database using VB6

 
0
  #4
Jun 19th, 2005
I want to create new table in Access database during the runtime of my VB code. I am developing a "Library Management System" using VB6. At first i have used SQL statement to do the job. But it worked for once & then it stopped working. No error message was displayed. I am using "Microsoft ADO
Data Control 6.0 (OLEDB)" to create link with the database & the provider is
"Microsoft Jet 4.0 OLE DB Provider". I am using MS Access2003 to create the
database & VB6 with MSDN installed. I cannot continue the project without removing this problem. Please rescue me!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 85
Reputation: williamrojas78 is an unknown quantity at this point 
Solved Threads: 4
williamrojas78's Avatar
williamrojas78 williamrojas78 is offline Offline
Junior Poster in Training

Re: how to create new table in MS Access2003 database using VB6

 
0
  #5
Jun 21st, 2005
try this

Set database = workspace.CreateDatabase (name, locale, options)

look in the help section. make a search for "CreateDatabase". you will find all the information there.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 85
Reputation: williamrojas78 is an unknown quantity at this point 
Solved Threads: 4
williamrojas78's Avatar
williamrojas78 williamrojas78 is offline Offline
Junior Poster in Training

Re: how to create new table in MS Access2003 database using VB6

 
0
  #6
Jun 21st, 2005
sorry, that is for a dao database, i did not read it all
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1
Reputation: dalwadijayen30 is an unknown quantity at this point 
Solved Threads: 0
dalwadijayen30 dalwadijayen30 is offline Offline
Newbie Poster

Re: how to create new table in MS Access2003 database using VB6

 
0
  #7
Aug 6th, 2007
'set DAO refference for your project
' set dim var frist
Dim rs1 As Recordset
Dim db As Database
Dim td As TableDef
Dim f1 As Field
'------------------------------

Private Sub Form_Load()

'field variable

Dim iFields as string

' open your database hear

Set db = OpenDatabase("C:\temp.mdb")

' crate your table
Set td = db.TableDefs("Table1")

'Now that the database is created, add fields to the database

For iFields = 1 To 7 'The last number can be changed.
Set fl = td.CreateField("Field " & CStr(iFields), dbInteger)
td.Fields.Append fl
Next iFields



End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC