VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create Database Through Visual Basic.

by Rajender Sharma (7 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 20th November 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create Database Through Visual Basic.

Rate Create Database Through Visual Basic.



On Error GoTo procerror
Screen.MousePointer = 11
Dim dbname As String
dbname = GetDBName()
If Len(dbname) > 0 Then
   CreateDB dbname
End If
procexit:
Screen.MousePointer = 0
Exit Sub
procerror:
MsgBox Err.Description
Resume procexit

End Sub

Public Function GetDBName() As String
On Error GoTo procerror
Dim filename As String
cd.DefaultExt = "mdb"
cd.DialogTitle = "Create Database"
cd.Filter = "VB Databases (*.mdb)|*.mdb"
cd.FilterIndex = 1
cd.Flags = cdlOFNHideReadOnly Or _
           cdlOFNOverwritePrompt Or _
           cdlOFNPathMustExist
cd.CancelError = True
cd.ShowSave
filename = cd.filename
On Error Resume Next
Kill filename

procexit:
GetDBName = filename
Exit Function


procerror:
filename = ""
Resume procexit
End Function

Public Sub CreateDB(dbname As String)
Dim db As Database
Set db = DBEngine(0).CreateDatabase(dbname, dbLangGeneral)
End Sub

Private Sub Command2_Click()
Form2.Show
End Sub

Private Sub Command3_Click()
Form3.Show
End Sub

Private Sub Command4_Click()
Form4.Show
End Sub



Download this snippet    Add to My Saved Code

Create Database Through Visual Basic. Comments

No comments have been posted about Create Database Through Visual Basic.. Why not be the first to post a comment about Create Database Through Visual Basic..

Post your comment

Subject:
Message:
0/1000 characters