943,987 Members | Top Members by Rank

Ad:
Apr 23rd, 2005
0

how to create new table in MS Access2003 database using VB6

Expand Post »
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!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shuvo is offline Offline
7 posts
since Apr 2005
Apr 26th, 2005
0

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

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
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
May 11th, 2005
1

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

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ahmadtamoor is offline Offline
3 posts
since May 2005
Jun 19th, 2005
0

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

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!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aster is offline Offline
1 posts
since Jun 2005
Jun 21st, 2005
0

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

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.
Reputation Points: 23
Solved Threads: 10
Junior Poster
williamrojas78 is offline Offline
111 posts
since Jun 2005
Jun 21st, 2005
0

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

sorry, that is for a dao database, i did not read it all
Reputation Points: 23
Solved Threads: 10
Junior Poster
williamrojas78 is offline Offline
111 posts
since Jun 2005
Aug 6th, 2007
0

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

'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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dalwadijayen30 is offline Offline
1 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: opening a pdf document??
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to display a certain date record in data report from the datagrid





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC