home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
source
/
chap14
/
vbu1403l.frm
< prev
next >
Wrap
Text File
|
1995-10-07
|
2KB
|
63 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4140
ClientLeft = 1140
ClientTop = 1512
ClientWidth = 6696
Height = 4524
Left = 1092
LinkTopic = "Form1"
ScaleHeight = 4140
ScaleWidth = 6696
Top = 1176
Width = 6792
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Public Sub NewData()
'
' create a new database
'
Dim dbFile As Database
Dim cDBFile As String
Dim cTable1 As String
Dim cTable2 As String
Dim nTemp As Integer
'
' set vars
cDBFile = "ch1401.mdb"
cTable1 = "CREATE TABLE Table1 (CustID TEXT(10),CustName TEXT(30),CustType TEXT(10));"
cTable2 = "CREATE TABLE Table2 (CustType TEXT(10),TypeName TEXT(20));"
'
' kill any current database
nTemp = MsgBox("Ready to Delete Any Existing Database?", vbInformation + vbYesNo, "Create Database")
If nTemp = vbNo Then
MsgBox "Create Database Canceled"
Else
On Error Resume Next
Kill cDBFile
On Error GoTo 0
'
' create empty DB
Set dbFile = DBEngine.CreateDatabase(cDBFile, dbLangGeneral)
'
' create tables
dbFile.Execute cTable1
dbFile.Execute cTable2
'
' add additional tables, indexes, relations, etc.
'
MsgBox "Database has been Created"
End If
End Sub
Private Sub Form_Load()
NewData
End Sub