Search This Blog

Thursday, September 1, 2011

Create table using VB6.0? in access

Q . How to Create a table using VB6.0? in access
Dim db_name As String
Dim db As Database
'Get the database name.
db_name = App.Path
If Right$(db_name, 1) <> "\" Then db_name = db_name & _
"\"
db_name = db_name & "testdb.mdb"
'
' Delete the database if it exists.
On Error Resume Next
Kill db_name
On Error GoTo 0
' Create the database.
Set db = DBEngine.CreateDatabase(db_name, dbLangGeneral)
' Create the table.
db.Execute "CREATE TABLE Dates (TheDate DATE, TheNumber INTEGER)"
Set db = Nothing
MsgBox "Done"

No comments:

Post a Comment