|
-
Jul 9th, 1999, 11:37 AM
#1
Thread Starter
Lively Member
The subject mostly explains it, but I'll repeat myself, how do u save a database file or CREATE one?
Justin
-
Jul 9th, 1999, 12:03 PM
#2
New Member
If you use a DAO then the following will solve the purpose
Dim dbname as database
set dbname = createdatabase("path and the name of the database")
This will create a MDB File and if you would like to open a database then
dim dbname as database
set dbname = opendatabase("Path to the database and the name")
Hope this solves your query
-
Jul 9th, 1999, 12:43 PM
#3
Thread Starter
Lively Member
Thx for the help. I did a little research on the syntax u gave me. I think I figured it out =]!
Set database = workspace.CreateDatabase (name, locale, options)
hehe
Thx Again
,
Justin =]
-
Jul 18th, 1999, 11:26 AM
#4
New Member
Try this code:
Private Sub DBBackup()
On Error Resume Next
dbsCamp.Close
Msg = ""
On Error GoTo CompactErr
OrigDBName = DBdir & "\Camp.mdb"
Set dbsCamp = OpenDatabase(DBdir & "\Camp.mdb")
'Show the properties of the original database.
'Msg = "Properties of the current Data Base --> " & DBdir & "\camp.mdb database." & Chr(10)
'With dbsCamp
' Msg = Msg & "Name=" & .Name & ", version " & .Version & Chr(10)
' Msg = Msg & " CollatingOrder = " & .CollatingOrder
' MsgBox Msg
' .Close
'End With
' Make sure there isn't already a file with the
' name of the compacted database.
For J = 1 To 50
If Dir(DBdir & "\Campbkup" & J & ".mdb") = "" Then
NewDBName = DBdir & "\Campbkup" & J & ".mdb"
J = 50
End If
Next J
If Dir(NewDBName) <> "" Then _
Kill NewDBName
dbsCamp.Close
' This statement creates a compact version of the
' Camp database called CampBkup.mdb
DBEngine.CompactDatabase DBdir & "\Camp.mdb", _
NewDBName, dbLangGeneral
Set dbsCamp = OpenDatabase(NewDBName)
Msg = "Properties of the your newly created Backup Data Base" & Chr(10)
With dbsCamp
Msg = Msg & "Name=" & .Name & ", version " & .Version & Chr(10)
Msg = Msg & " CollatingOrder = " & .CollatingOrder
End With
MsgBox Msg & Chr(10) & "Data Base --> " & DBdir & "\camp.mdb successfully backed up " & Chr(10) _
& "to file --> " & NewDBName & "."
dbsCamp.Close
Exit Sub
CompactErr:
If Err.Number <> 0 Then
Msg = Msg & Chr(10)
Msg = Msg & "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
End If
EOJ
End Sub
-
Apr 9th, 2001, 08:23 AM
#5
Addicted Member
How do I create a new database using ADO?
Always looking for a better and faster way!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|