????? ????? ??? ??????? ??? ??????? ??????? ?? ???? ???? ?????? ??????? ?? Access 2000

?????? ????????? ?????? ?????????
???? ???????: 209862 - ??? ???????? ???? ????? ????? ??? ???????.
?????? ??? ????? Microsoft Access 97 ?? ??? ???????? ???? 181076.
??????: ????? ????? ?????? ??????? ??????? ???????? ? ?????? ?????? ??????????.

??? ????? ??? ?????? ??? ??? ????? ?????? Microsoft Access (.mdb).

????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ?????? ????? ??????? ???? ?????? ?????? ?????? ????? ??????? ???????? ?? ????? ????????. ????? ???? ???? ?????? ?????? ???????? Microsoft Office 2000 ?????? Edition ???????. ?? ???? ?????? ??????? ???????? ???? ?? ???? ?? ?????? ?? ????? ???????? ??? ??????? ???????.

?????? ??? ???? ????? ??? ?????? ??? ??????? ???? ?????? ????? (API) ????? ????? ??????? Microsoft Windows, ???? ??? "???? ??????" ????? ???????? (Solutions9.mdb.) ?????? ??? Solutions9.mdb ? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
248674ACC2000: ???? ?????? ????? ????? ???????? ???????? ??? ?????? ?????? Microsoft (MSDN) ? Orders
??? ????? ?????? Solutions9.mdb ? ??? ??????? ????? ?????? ?????? ?? ?????? ????? "??? ?????" ?? ???? ??? ?????? ??????? ??? ??? ??????? ?? ?????? ????? ????.

??????? ????

???? Microsoft ??????? ???????? ??? ??? ?? ???? ??????? ?? ?? ?????. ??? ????? ???? ?? ????? ??? ???????? ??????? ?????? ???????? ?? ???????? ???? ????. ????? ??? ??????? ???? ?????? ?? ??? ??????? ???? ??? ????? ?? ??????? ???? ??? ????????? ?????? ?????? ?????????. ???? ??????? ????? ??? Microsoft ??? ????? ????? ???? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ??????? ?????. ????? ?????? ?????? ????? ????? ????? ???????? ?????? ?? ??????? ?? ????? ?????? ????? ?? ???? ???? ????? (????? ?????? ??????? ???????) ????? ?? ????????? ??????? ? ??????, ????? ??????? ? ??????? ??????? ?? ????? ?????? ???? ??? ?? ??????? ???? (????? ?????? ??????? ????????). ???? ???? ??????? ?????? ?? ????? ?????? ??????? ???????? ??? ????? ???????? ??? ??????? ???????. ??? ?? ??? ????? ???????? ??? ??????? ??????? ???? ????? ?? ????????. ????? ????? ?????? ????? ?? ?? ??? ????? ???????? ??? ??????? ??????? ????? ?? ????? ???????? ??? ?? ?????? ???????? ?????? ??????.

???? ?????? ?????? ????? ????? ??? ?????? ?????? ?? ????????. ?????? ??? ??????? ????? ????? ?????? ?? ??? ?????? ??? ??????? ??? ??????? ??????? ? ????? ??????? ??? ???? ?????? ???????? ?? ???????? ??????? ??? ??? ????? ????????.

????? ??? ??????? ???? ???? ?????? Microsoft ?????? ?????? ???? ????? ???????? Microsoft Office 2000 ?????? Edition ???????. ??? ?? ??? ???? ???? ?????? ??? ????? ???? Browse() ?? ??????.

??????: ??? ?????? ???? ?????? ?????? ?????? ??? ???? ?????? ?????? ????? ???????? ??? ???? ??????? "????" ? "????? ????? ??????" ?????? ?????? ?????? "DLL ????? ?? ????? ??????? Comdlg32.ocx ????????. ????? ?? ????????? ??? ??????? "????" ? "????? ????? ???? ???????? ??????? ?? ???"??????? "?? ??? ???????.

????? ????? ??? ????? ????? ?????? ??????? ???????

?????: ??? ???? ??????? ???????? ?? ??? ??????, ????? ????? ????? ????? ???????? Northwind.mdb. ?? ???? ?? ???? ???????? ?? ??? Northwind.mdb ?? ???? ??????? ??????? ??? ???? ?? ????? ????????.

  1. ????? ??? ????? ?????? Access ???? ???? ?? ??? FrontEnd.mdb.
  2. ?? ??????? ???? ??? ??? ????? ?????? ?????? ? ?? ???? ??? ??? ?????.
  3. ?????? ?????? ????? ????? ???????? Northwind.mdb ?? ???? ??? ??????. ?? ???? ?????? ??? ????? ???? ??? ????? ???? ?? ???? ??? ?????.
  4. ????? ????? ???? ??????? ?? ????? ??? ?? ???? ?? ??????? ?? ????? ????? "?????":
    ???????: frmNewDataFile

    ???? ????:
    ?????: txtFileName
    ???: 3 "
    ???? ?????? ?????? ???????:
    ?????: xDialog
    ?? ?????:
    ?????: cmdBrowse
    ??????? ?????????: ???????...
    ??? ?????: =Browse()
    ?? ?????:
    ?????: cmdLinkNew
    ??????? ?????????: ????? ??????????
    ??? ?????: =Processtables()
    ?? ?????:
    ?????: cmdCancel
    ??????? ?????????: ?????
    ???_?????: [????? ???]
    ?????: ???
  5. ?? ??????? ???? ???? ??? ?????.
  6. ???? ?? ???? ??????? ??????:
    Private Sub cmdCancel_Click()
       On Error GoTo Err_cmdCancel_Click
     
       MsgBox "Link to new back-end cancelled", vbExclamation, "Cancel Refresh Link"
       DoCmd.Close acForm, Me.Name
    
    Exit_cmdCancel_Click:
       Exit Sub
    
    Err_cmdCancel_Click:
       MsgBox Err.Description
       Resume Exit_cmdCancel_Click
    
    End Sub
    					
  7. ?? ??????? "?????" ? ???? ??? ????? FrontEnd.
  8. ??? ??????? frmNewDataFile ???????.
  9. ?? ?????? "????? ??????" ? ???? ??? ????? ????? ?? ???? ??? ????.
  10. ?? ??????? ????? ? ???? "?????" ? ??? ????? ?????? Microsoft DAO 3.6 ??? ?? ??? ????? ?????? ?? ?? ???? ??? ?????.
  11. ???? ?? ???? ???????? ???????? ???????:
    Dim UnProcessed As New Collection
           
    Public Function Browse()
        ' Prompts user for back-end database file name.
        On Error GoTo Err_Browse
        
        Dim strFilename As String
        Dim oDialog As Object
        Set oDialog = [Forms]![frmNewDatafile]!xDialog.Object
        
        With oDialog                    ' Ask for new file location.
            .DialogTitle = "Please Select New Data File"
            .Filter = "Access Database(*.mdb;*.mda;*.mde;*.mdw)|" & _
            "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
            .FilterIndex = 1
            .ShowOpen
            If Len(.FileName) > 0 Then  ' user responded, put selection into text box on form.
               [Forms]![frmNewDatafile]![txtFileName] = .FileName
            End If
        End With
    
    Exit_Browse:
        Exit Function
    
    Err_Browse:
        MsgBox Err.Description
        Resume Exit_Browse
    
    End Function
    
    Public Sub AppendTables()
    
        Dim db As DAO.Database, x As Variant
        Dim strTest As String
        ' Add names of all table with invalid links to the Unprocessed Collection.
        Set db = CurrentDb
        ClearAll
        For Each x In db.TableDefs
            If Len(x.Connect) > 1 And Len(Dir(Mid(x.Connect, 11))) = 0 Then
            ' connect string exists, but file does not
                 UnProcessed.Add Item:=x.Name, Key:=x.Name
            End If
        Next
    
    End Sub
    
    Public Function ProcessTables()
    
        Dim strTest As String
        On Error GoTo Err_BeginLink
        
        ' Call procedure to add all tables with broken links into a collection.
        AppendTables
        
        ' Test for existence of file name\directory selected in Common Dialog Control.
        strTest = Dir([Forms]![frmNewDatafile]![txtFileName])
        
        On Error GoTo Err_BeginLink
        If Len(strTest) = 0 Then   ' File not found.
            MsgBox "File not found. Please try again.", vbExclamation, "Link to new data file"
            Exit Function
        End If
        
        ' Begin relinking tables.
        Relinktables (strTest)
        ' Check to see if all tables have been relinked.
        CheckifComplete
        
        DoCmd.Echo True, "Done"
        If UnProcessed.Count < 1 Then
             MsgBox "Linking to new back-end data file was successful."
        Else
             MsgBox "Not All back-end tables were successfully relinked."
        End If
        DoCmd.Close acForm, [Forms]![frmNewDatafile].Name
        
    Exit_BeginLink:
        DoCmd.Echo True
        Exit Function
        
    Err_BeginLink:
        Debug.Print Err.Number
        If Err.Number = 457 Then
            ClearAll
            Resume Next
        End If
        MsgBox Err.Number & ": " & Err.Description
        Resume Exit_BeginLink
    
    End Function
    
    Public Sub ClearAll()
        Dim x
        ' Clear any and all names from the Unprocessed Collection.
        For Each x In UnProcessed
           UnProcessed.Remove (x)
        Next
    End Sub
    
    Public Function Relinktables(strFilename As String)
    
        Dim dbbackend As DAO.Database, dblocal As DAO.Database, ws As Workspace, x, y
        Dim tdlocal As DAO.TableDef
        
        On Error GoTo Err_Relink
        
        Set dbbackend = DBEngine(0).OpenDatabase(strFilename)
        Set dblocal = CurrentDb
        
        ' If the local linked table name is found in the back-end database
        ' we're looking at, Recreate & Refresh its connect string, and then
        ' remove its name from the Unprocessed collection.
         For Each x In UnProcessed
            If Len(dblocal.TableDefs(x).Connect) > 0 Then
                For Each y In dbbackend.TableDefs
                    If y.Name = x Then
                        Set tdlocal = dblocal.TableDefs(x)
                        tdlocal.Connect = ";DATABASE=" & _
                        Trim([Forms]![frmNewDatafile]![txtFileName])
                        tdlocal.RefreshLink
                        UnProcessed.Remove (x)
                    End If
                Next
            End If
        Next
    
    Exit_Relink:
        Exit Function
    
    Err_Relink:
        MsgBox Err.Number & ": " & Err.Description
        Resume Exit_Relink
    
    End Function
    
    Public Sub CheckifComplete()
    
        Dim strTest As String, y As String, notfound As String, x
        On Error GoTo Err_BeginLink
        
        ' If there are any names left in the unprocessed collection,
        ' then continue.
        If UnProcessed.Count > 0 Then
            For Each x In UnProcessed
                notfound = notfound & x & Chr(13)
            Next
            ' List the tables that have not yet been relinked.
            y = MsgBox("The following tables were not found in " & _
            Chr(13) & Chr(13) & [Forms]![frmNewDatafile]!txtFileName _
            & ":" & Chr(13) & Chr(13) & notfound & Chr(13) & _
            "Select another database that contains the additional tables?", _
            vbQuestion + vbYesNo, "Tables not found")
            
            If y = vbNo Then
                Exit Sub
            End If
            
            ' Bring the Common Dialog Control back up.
            Browse
            strTest = Dir([Forms]![frmNewDatafile]![txtFileName])
            If Len(strTest) = 0 Then   ' File not found.
                MsgBox "File not found. Please try again.", vbExclamation, _
                "Link to new data file"
                Exit Sub
           End If
           Debug.Print "Break"
           Relinktables (strTest)
        Else
           Exit Sub
        End If
        
        CheckifComplete
        
    Exit_BeginLink:
        DoCmd.Echo True   ' Just in case of error jump.
        DoCmd.Hourglass False
        Exit Sub
    
    Err_BeginLink:
        Debug.Print Err.Number
        If Err.Number = 457 Then
            ClearAll
            Resume Next
        End If
        MsgBox Err.Number & ": " & Err.Description
        Resume Exit_BeginLink
    
    End Sub
    					
  12. ?? ??????? "?????" ? ???? ??? ????? FrontEnd.
  13. ??? ?????? ??????? ?? RelinkCode ?? ?? ?????? ????.
  14. ????? ????? ????? ???????? Northwind.mdb ?? ???? ??? ???? ??? ??? ????? ?????? ????? ?? ???? ??????? ???????? ?? FrontEnd.mdb ?????? ??? ?????.
  15. ???? ????? frmNewDataFile ?? ???? ??? ???? ???????.
  16. ?? ???? ?????? ?????? ????? ??? ?????? ???? ? ??? ???? Northwind.mdb ?? ????? ???? ??? ?? ???? ??? ???.

    ???? ?? ?????? ???? ????? ?????? ?????? ???? ?? ???? ???? ??? ??????? ????? ??.
  17. ???? ??? ???? ????? ?????????? ?? ???????.

    ???? ???? ??????? ??????? ??? ???????? ?? ???????:
    ???? ??? ???????? ??? ??????? ??????? ??????? ?????.

????? ????? ??? ????? ??? ????? ??????

?????? ?? ?????????? ??? ??????? ???????? ?? ??? ???? ???? ???? ????? ???????? FrontEnd.mdb ? ????? ????? ????? ???? ???? ????? ?????? ??????? ???????:
  1. ????? ????? ???? ?? ????? ??? ?? ???? ?? ??????? ?? ????? ????? ?????.
  2. ?? ??????? ???? ???? ??? ?????.
  3. ???? ??????? ?????? ??? ??????? ??? ??? ???????:
    Private Sub Form_Open(Cancel As Integer)
          ' Tests a linked table for valid back-end.
          On Error GoTo Err_Form_Open
          Dim strTest As String, db As DAO.Database
          Dim td As DAO.TableDef
          Set db = CurrentDb
          For Each td In db.TableDefs
             If Len(td.Connect) > 0 Then   ' Is a linked table.
                On Error Resume Next   ' Turn off error trap.
                strTest = Dir(Mid(td.Connect, 11))   ' Check file name.
                On Error GoTo Err_Form_Open   ' Turn on error trap.
                If Len(strTest) = 0 Then   ' No matching file.
                   If MsgBox("Couldn't find the back-end file " & _
                      Mid(td.Connect, 11) & ". Please choose new data file.", _
                      vbExclamation + vbOKCancel + vbDefaultButton1, _
                      "Can't find backend data file.") = vbOK Then
                         DoCmd.OpenForm "frmNewDataFile"   ' Open prompt form.
                         DoCmd.Close acForm, Me.Name
                         Exit Sub                          ' to refresh links
                   Else
                      MsgBox "The linked tables can't find their source. " & _
                      "Please log onto network and restart the application."
                   End If
                End If
             End If
          Next   ' Loop to next tabledef.
          DoCmd.Close acForm, Me.Name
    Exit_Form_Open:
          Exit Sub
    Err_Form_Open:
          MsgBox Err.Number & ": " & Error.Description
          Resume Exit_Form_Open
          End Sub
    					
  4. ?? ??????? "?????" ? ???? ??? ????? FrontEnd.
  5. ???? ??????? frmCheckLink ?? ?? ?????? ????.
  6. ?????? frmCheckLink ?????? ??? ??????? ??? ????? ??????? ???? ??? ??? ??????? ? ??? frmCheckLink ?? ??????? ??? ?????/???? ?? ???? ??? ?????.
  7. ???? frmCheckLink ????? ???? ???? ??? ?????? ?????? ??? frmCheckLink ?? ?????? "????? ??????" ? ???? ??? ????? ??? ??????? ????????, ???? ?????? ???? ???????? ????? ?? ???? ?????? ????? frmCheckLink ?? ?? ???? ??? ?????.
  8. ??? ????? ????? ???????? Northwind.mdb ??? ???? ??? ??? ????? ?????? ????? ?? ???? ??????? ???????? ?? FrontEnd.mdb ?????? ??? ?????.
  9. ???? ?????? ?? ??? ??? FrontEnd.mdb.

    ???? ???? ????? ????? ???????
    ?? ???? ?????? ??? ??? ??????? database file. ?????? ?????? ??? ?????? ????.
    ??? database file ?? ??? ????? ??? ????? ?????? ??????? ???????.

    ??? ??? ?????? ??? "?????" ? ???? ?? ??? ????? ?????? ??? ??????? ??????? ????? ??????? frmNewDataFile ?? ???? ?????? ?????????? ??????. ??? ???? ??? "????? ?????" ? ???? ????? ????? ???????:
    ?? ???? ?????? ??? ??????? ???????? ??????. ?????? ????? ?????? ??? ???? ??????? ?? ????? ????? ????????.

?????

?????? ??? ??????? ?????? ??? ????? ?????? ?????? ??? ????? ??????? ???????? ?? ??????? "???? ??????" ???????? (Solutions9.mdb) ? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
154397ADT/ODE ????? ????? ???? ????? RefreshTableLinks ?? Solutions.mdb
?????? ??? ??????? ?????? ??? "????" ? "????? ?????" ? ???? ??? ???? ????????? ????????? ??????? ?? "????? ??????? ?? Microsoft:
240956MOD2000: ???? ?????? ????? ???? ?????? ?? ????? ????? ???????
236143MOD2000: ????? ??? "????? ?????" ? "????

???????

???? ???????: 209862 - ????? ??? ??????: 16/????? ??????/1426 - ??????: 3.0
????? ???
  • Microsoft Access 2000 Standard Edition
????? ??????: 
kbmt kbprogramming kberrmsg kbhowto kbinfo KB209862 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????209862

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com