?? ???? ????? ?? ????? ?? ??? ???????? ?? ??????? ???????? ??? ???? Excel ?? Access 2002 ?? Office Access 2003 ?? Office Access 2007

?????? ????????? ?????? ?????????
???? ???????: 904953 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

?? Microsoft Office Access 2007 ?? ?? Microsoft Office Access 2003 ?? ?? Microsoft Access 2002 ? ???? ?? ???? ????? ?? ????? ?? ??? ???????? ?? ??????? ???????? ??? ???? Microsoft Excel.

???????? ??? ???? ?? ????? ??? ??????? ????? ???? ??? ?????? ??????? ??????:
  • ????? ??????? ???????? ???????? ?? ??????? ???????? ??? ???? Excel.
  • ????? ????? ???? ??????? ??? ???????? ?? ??????? ???????? ??? ???? Excel.
  • ????? ??????? DAO ?? ADO ?????? ????? ??????? ???? ?? ????? ??? ???? Excel.
???? ??????? ??????? ??? ????? ??????? ?????? ??????? ?? ???? Excel ??????:
??? ?? ??????? ??????? ??????? ???? ???????
???? ??????? ??????? ??? ??????? DAO ??????? ????? ??????? ???????? ??? ???? Excel:
????? ????? ??? ??? ??????? '3027'. ????? ?????? ?? ???? ??????? ???.
??? ?????? ????? ???????? ???????? ?? ADO ??????? ?? ???? ???? ?? ???? ??? ??? ?????? ??? ???:
-2147217911 (80040e09)
??? ????? ??????? ????? ????? ?? ???? Excel ????? ????? ????? ??????? ??? ?? ???? ??? ????? ???? Excel ??? ????? ?????? Access:
??? ?? ??????? ??????? ??????? ???? ???????

?????

??? ????? ???? ????? ???? ?? ?? ?????? ??????? ??????:
  • ??????? Office Access 2007.
  • ????? Microsoft Office 2003 Service Pack 2 (SP2) ?? ???? ???? ???? ?? ??? ??????? Access 2003 ???? ?? ??????? ??? ???? ?????? SP2.

    ????? ?? ????????? ??? Microsoft Office 2003 Service Pack 2 ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    887616??? Office 2003 Service Pack 2
  • ??? ?????? ??????? ????? ?? Access 2002 (KB904018) ?????? 18 ?????? 2005.

    ????? ?? ????????? ??? ??????? ????? ?? Access 2002 (KB904018) ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    904018??? ??????? ????? ?? Access 2002: 18 ?????? 2005
  • ????? ????? ??? ????? Access ????? Microsoft Office 2003 Service Pack 2 (SP2) ?? ???? ???? ???? ?? ??? ??????? Access 2003 ???? ?? ??????? ??? ???? ?????? SP2 ?? ??????? ????? ?? Access 2002 (KB904018) ???? ??? ?????? 18 ?????? 2005 ?? ????.
    ?????? ??? ???? ?? ????????? ??? ????? ????? ????? ????? Office ?? ??????? "??? ????" ??? ????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    916176?????? ??????? ????? ??? ??????? ???? ?? ??????? ?? ???? ????? Access ??? ????? ???? ????? ??? ????????? ?? Access 2003 ?? ?? Access 2002

???? ??????

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

??????? 1: ??????? Microsoft Excel

??? ???? Excel ???????? ?? Microsoft Excel ?? ?? ?????? ????????? ??? ??????. ??? ????? ????????? ??? ????????? ?? ?? ?????? ??????.

??????? 2: ??????? Office Access 2007 ?? Access 2003 ?? Access 2002

??????? ???? Excel ???????? ??? Access ?? ?? ?????? ????????? ??? ????????. ??? ????? ????????? ????? ???????? ??? .xls ?? Excel.

?????? ?????? ?? Access ??? Excel ????? ????????? ???????? ??????? ?? Access. strSQL
Public Sub WorkArounds()
On Error GoTo Leave

    Dim strSQL, SQL As String
    Dim Db As ADODB.Connection
    Set Db = New ADODB.Connection
    Db.CursorLocation = adUseClient
    Db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=<AccessPath>"
    'Note: In Office Access 2007, use the following line of code:
    'Db.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source=<AccessPath>"
    SQL = "<MyQuery>"
    CopyRecordSetToXL SQL, Db
    Db.Close
    MsgBox "Access has successfully exported the data to excel file.", vbInformation, "Export Successful."
    Exit Sub
Leave:
        MsgBox Err.Description, vbCritical, "Error"
        Exit Sub
End Sub

Private Sub CopyRecordSetToXL(SQL As String, con As ADODB.Connection)
    Dim rs As New ADODB.Recordset
    Dim x
    Dim i As Integer, y As Integer
    Dim xlApp As Excel.Application
    Dim xlwbBook As Excel.Workbook, xlwbAddin As Excel.Workbook
    Dim xlwsSheet As Excel.Worksheet
    Dim rnData As Excel.Range
    Dim stFile As String, stAddin As String
    Dim rng As Range
    stFile = "<ExcelPath>"
    'Instantiate a new session with the COM-Object Excel.exe.
    Set xlApp = New Excel.Application
    Set xlwbBook = xlApp.Workbooks.Open(stFile)
    Set xlwsSheet = xlwbBook.Worksheets("<WorkSheets>")
    xlwsSheet.Activate
    'Getting the first cell to input the data.
    xlwsSheet.Cells.SpecialCells(xlCellTypeLastCell).Select
    y = xlApp.ActiveCell.Column - 1
    xlApp.ActiveCell.Offset(1, -y).Select
    x = xlwsSheet.Application.ActiveCell.Cells.Address
    'Opening the recordset based on the SQL query and saving the data in the Excel worksheet.
    rs.CursorLocation = adUseClient
    If rs.State = adStateOpen Then
        rs.Close
    End If
    rs.Open SQL, con
    If rs.RecordCount > 0 Then
        rs.MoveFirst
        x = Replace(x, "$", "")
        y = Mid(x, 2)
        Set rng = xlwsSheet.Range(x)
        xlwsSheet.Range(x).CopyFromRecordset rs
    End If
    xlwbBook.Close True
    xlApp.Quit
    Set xlwsSheet = Nothing
    Set xlwbBook = Nothing
    Set xlApp = Nothing

End Sub
?????? ?? ??? ??????? ??? ??????? ??????? ??????? ???????:
  • <AccessPath>
  • <ExcelPath>
  • <MyQuery>
    <MyQuery>?? ???? ???? ????????? ???? ???? ?????? ????? ??????? ?? ????? ?????? Access. ?? ????? ????? ????????? ??? ???? Excel.
  • <WorkSheets>
    <WorkSheets>?????? ?????? ???? ????? ?? Excel ???? ???? ????? ???????.
?????? ??? ?????? ??? ???? CTRL + G ??? ??? ???? ???? ???? ?????? ?? ?? ???? ENTER.

??????? ????

????? ?????? ????????? ???? Microsoft ?????? ??????? ?? Access 2003 ??? Access 2002 ?????? ?????????? ?????? ???????? ?? ??????? ???????? ???? ???? ??? ???? ?? ???? Excel. ??? ???? ??? ????? ??????? ??????? ?? ???? Excel ???? ????????? ?? ???? ????? ?? Access.

???????

???? ???????: 904953 - ????? ??? ??????: 05/?????/1428 - ??????: 7.2
????? ???
  • Microsoft Office Access 2007
  • Microsoft Office Access 2007 Runtime
  • Microsoft Office Access 2003
  • Microsoft Office Access 2003 Runtime
  • Microsoft Office Excel 2003
  • Microsoft Access 2002 Standard Edition
  • Microsoft Access 2002 Runtime
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
????? ??????: 
kbmt kbexpertiseadvanced kbdatabase kbtshoot kbprb KB904953 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????904953

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

 

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