+ Reply to Thread
Results 1 to 4 of 4

CopyFromRecordset Method to Excel sheet producing duplicate rows?

  1. #1
    Registered User
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    CopyFromRecordset Method to Excel sheet producing duplicate rows?

    Hi,
    New to the forums, kept meaning to join up but never did, I suppose it's the old story of not joining til I have a question!!

    I just had a quick search on the following question, but didn't find anything.

    I have upgraded from SQLServer 2003 to SQLServer2005 last weekend.

    I have spreadsheets that use the following VBA structure to download data:
    -----------
    Set aRS = New Recordset
    SQLSTring = "SELECT * FROM Table" Very simple query

    aRS.Open SQLSTring, aDBConnection, adOpenKeyset, adLockOptimistic
    aRange.CopyFromRecordset aRS
    aRS.Close
    ------------


    Which is the straight forward method.

    Now I get duplicate lines in my excel sheet download which I did not get previously.

    If I run the query in my query analyser it works fine without duplications(this is the work around at the moment).

    I am stumped for the moment as to what errors I could have??
    Any ideas greatly appreciated!!
    Last edited by Enee; 10-30-2009 at 05:53 AM.

  2. #2
    Registered User
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: CopyFromRecordset

    Anyone even seen a problem like this?

  3. #3
    Registered User
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: CopyFromRecordset Method to Excel sheet producing duplicate rows?

    Ok so, I eventually read the rules...

  4. #4
    Registered User
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: CopyFromRecordset Method to Excel sheet producing duplicate rows?

    So it was an issue with adOpenKeyset in the end, thanks for all the help...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1