Results 1 to 4 of 4

Thread: Updating New Datase

  1. #1
    Guest

    Post

    Any ideas on how to update a pre existing database with a new one?

    I need to get all the records from the old database into a the new one.



    ------------------
    Dave
    [email protected]

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Location
    Raleigh, NC
    Posts
    70

    Post

    If this is Access, than you could link the tables in the old database into the new one, then use update queries (or even cut and paste) to copy all the old data into the new tables. Then delete the table links.

    Bash

  3. #3
    Guest

    Post

    Sorry, I should have mentioned VB using DAO.

    ------------------
    Dave
    [email protected]

  4. #4
    New Member
    Join Date
    Jul 1999
    Posts
    3

    Post

    Try this:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width