???? ID: 194124 - ????? ???????: 02 ?????? 2010 - ??????: 4.0

PRB: Excel ??? NULL DAO OpenRecordset ????? ?? ??? ??? ??? ??

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

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

?????

?? ???? Excel ?????????? DAO OpenRecordset ???? ?? ????? ???? ?? ??? ?????? ???? ?? ??? ??, ??? ????? ?? ???? Excel ????? ??? ???? ?? ???? ?? ?? ??? ??? ?? ?????????? ??? ?? ?? ???? ??? ?? ?????????? ?? ???? ?? ?? ???????? ?? ?? Excel ?? ?? ?? ????? ??? ??? datatypes intermixed ????

????

?? ?????? Excel ISAM ??????? ?? ??? ?? ?? ???? ?? ?? ?? ???? Excel ????? ?? datatype ????????? ???? ??, ?? ??? ??? ?????? datatype ISAM ??????? ?? ???? ?? ?? ??? ?? ??? ?? ??? ?? ?? ?? defaulted ???? ?? ??? Excel ????? ?? ???? Excel ISAM ??????? ???? ??? ????????? ??? ???????? ??? ?? ??????? ?? ??? ?? ?????? ???? Excel ????? ?? datatype ????????? ???? ??, ?? ??? ???? sampling ??? ????? ?? majority ?? ???????????? ???? ???? ??? datatype ????? ???

????????

?? ??????? ?? ??? ?? ?????? ???:
  1. Insure ?? Excel ??? ???? ??? ?? ??? ??? ???? ???? ??? ??? ???? ??? ?? ??? Excel ????? reformatting ????? ???? ???? ??? Excel ????? reformatting ?? ??? ?? ?????? ????? ???? ???? ???? ?????? ??? Excel ???, ?? ????? ???? ??? ?? ?????? ????? ?? ??? ?? ???? ???? ?? ??? F5 ?? ????? ?? ???? ????
  2. ?????? IMEX ?????? = 1; OpenDatabase ?????? ??? ???????? ?? ?????? ???? ?? ??? Excel. ?????? ?? ???::
          Set Db = OpenDatabase("C:\Temp\Book1.xls", _
                False, True, "Excel 8.0; HDR=NO; IMEX=1;")
    
    						
    ????? ???: ?????? IMEX = 1 ???? ??? ?? ????? ???? ?? ??? ??????? ???? ??? ?? ?????? ???, ????????? ImportMixedTypes ??? ???? = ??? noticed ?? ?????? ?? forces ????-???? ???? ?? ??? ??? ?????? ???? ?? ???? ??? ???? ??? reliably ????? ???? ?? ???, ???? ?? ??? ???? ?? ????????? ??????, TypeGuessRows ?? ??????? ???? ?? ??? = 8? ISAM ???????? ??? ?? ??????? ???? ?? ????????? ??? ????? ?? ?? ?? sampling ?? datatype ????????? ???? ??? ??? ?? ????? row sampling IMEX ??? ???? ?? ?? ??? ??????????, ?? = 1 ???????? datatype ??? ??? ?????? ???? ?????; ?????????? ??????

    Careful ???? ????? ?? IMEX = 1 ????? ???? ???? ?? indiscriminately. ???? ???? ?? ?? ???, ?????? ???? ???? ?? ?????? ???? ??? ????????? ?? ???? ??? ???? appends ?? ?? ??? ??? ???? ?? ?????? ???? ???

    IMEX ?? ??????? ???????? ???:
            0 is Export mode
            1 is Import mode
            2 is Linked mode (full update capabilities)
    
    						
    ???? ???????? ?? ??? ?????? ????? ??? ?? ????????? ????? ??:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.5\Engines\Excel

    ?? ??????? ?? ??? ?? ???? ?? ?????? ??? ?? ????? ?? Excel ?????????? ??? ??? ????? ????? ??? ???????? ???? ???

??????

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

???? ???????

??????? ?? ???: ??????? ???? ?? ??? ???

?? ?????? ?? ????????? ????, ?? ??? ???? ??? ??? Excel ????????????? ?? ??????? Sheet1 ?????????? ?? ???? Sheet1 ?? ???? ?????, ??? ????? ??? - 123, aaa, 456, bbb, 789 ???? ????? ?? ????????????? ?? ???? C:\Temp ?????????? ??? ??????, ?? ??? Book1.XLS ????

Visual Basic ??? ?? ?? ???? EXE ????????? ?????, ?? ????? ????? ?? ???? ????:
  1. Microsoft DAO 3.5 ???????? ????????? ?? ??? ??? ?????? ?????? ????? ??? 6.0, ??? ?? Microsoft DAO 3.51 ???????? ????????? ?? ??????
  2. ?? ??????? ?? ??? ??? CommandButton ???????
  3. ??????? ?? ??????? Declarations ?????? ??? ????? ??? ?? ????:
          Dim Db As Database
          Dim Rs As Recordset
    
          Private Sub Command1_Click()
              Set Rs = Db.OpenRecordset("Sheet1$")
              'This will print the spreadsheet Text values as Nulls.
    
              Do While Not Rs.EOF
                  Debug.Print Rs(0)
                  Rs.MoveNext
              Loop
    
          End Sub
    
          Private Sub Form_Load()
              'HDR refers to the Excel header row.
          Set Db = OpenDatabase("C:\Temp\Book1.xls", _
                   False, True, "Excel 8.0; HDR=NO;")
    
          End Sub
    
          Private Sub Form_Unload(Cancel As Integer)
              Db.Close
              Set Db = Nothing
    
          End Sub
    
    						
    F5 ????? ??? ?? ????????? ?? ????? ?? ??? ???? ?? ???? ????? ??? ????? ?? ??? ??????? ???? ??? ?? ?? ??? ??? ??? ??? Excel ?????????? ??? ????? ?? majority ??? ?? ??? ?? ??, ?? ?? ??? ??? ?????? ???? ?? ??????? ??????, ???????? ??? ???? ??? Nulls ?? ??? ??? ?????

??????

???????? ??????? ?? ???, ????? ????? ???? ?? Microsoft ???????? ??? ?????:

190195  (http://support.microsoft.com/kb/190195/EN-US/ ) : HOWTO: DAO ?? ??? Excel ????? ?? ??????? ?? ???????

???? ???? ???? ??:
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 4.0 Enterprise Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
??????: 
kbprb kbmt KB194124 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:194124  (http://support.microsoft.com/kb/194124/en-us/ )