| | |
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
![]() |
•
•
Join Date: Apr 2005
Posts: 7
Reputation:
Solved Threads: 0
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!!
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!!
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
http://www.timesheetsmts.com/adotutorial.htm
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
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!!
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!!
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Solved Threads: 0
'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
' 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
![]() |
Similar Threads
- Custom Database Admin Tool. (PHP)
- how to create a sql table through coding in vb.net (IT Professionals' Lounge)
- Extracting data from large SINGLE-table database to MULT-table relational database (MySQL)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: opening a pdf document??
- Next Thread: how to display a certain date record in data report from the datagrid
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window






