the problem is that i want to make the database name variable like 'x' which is the name of the new database,when the user choose to overwrite the program should use the app.path and the file name which is \'x'.mdb
h:
Dim x As String
x = InputBox("Enter the database name", "Database Name", "new database")
If x = "" Then
MsgBox "Wrong database Name"
Exit Sub
End If
On Error GoTo s
Set db = CreateDatabase(x, dbLangGeneral)
db.Execute ("create table RegForm (RDate date,RName text (30),RAddrs text (100),RTel text (25),REmail text (50),RDevc text (20),RModel text (20),RSno text (20),ID text (10));")
db.Close
MsgBox "database has been created"
Exit Sub
s:
Dim e As String
e = MsgBox("Database name is used,Do you want to overwrite it?", vbYesNoCancel + vbCritical, "Error")
If e = vbYes Then
'The problem is here*************
'*****************************
Kill App.Path & "\+x+.mdb"
'*****************************
Set db = CreateDatabase(x, dbLangGeneral)
db.Execute ("create table RegForm (RDate date,RName text (30),RAddrs text (100),RTel text (25),REmail text (50),RDevc text (20),RModel text (20),RSno text (20),ID text (10));")
db.Close
MsgBox "database has been created"
Exit Sub
End If
If e = vbNo Then
GoTo h
End If
End Sub

New Topic/Question
Reply



MultiQuote



|