+ Reply to Thread
Results 1 to 19 of 19

Run-time error '-2147467259 (80004005)' / unable to locate problem

  1. #1
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi,

    I have one table and two queries:

    Trades: TradeID, StrategyID, AssetTypeID, Identifier, Nominal, Shares, Contracts, Currency, ReferencePortfolioCode, Ticker, RedID, Maturity, AverageCleanPrice, CurrentCleanPrice, AverageClosingPrice, ClosingDate, TargetPrice, Coupon, CouponFreq, StopLoss, Rationale, TimeStamp, Description, TotalPerformance, TotalPerformanceEUR, TickValue, TickSize, UploadOpen, UploadClose, BuySellProtection, MarketValueOpen, MarketValueClose, MarketValueCurrent, Position, ILB_Factor, ILB_Factor_AtOpen, TotalPerformanceCP1, TotalPerformanceEURCP1, MarketValueCP1, CP1Price, SecurityDes, EquityTicker, ABSPoolFactorAtOpen, ABSPoolFactorCurrent, ABSPoolFactorCP1, FxAtBuy, CurrentCleanPriceBid, CurrentCleanPriceAsk, CashMsg, CDS_MV_Open_Clean, CDS_MV_Open_Clean_CP1, CDS_MV_Close_Clean, CDS_MV_Current_Clean, Seniority, IlliquidAssetBidAsk

    AssetClass03_NotClosed: AssetType, PortfolioCode, Identifier, TradeDate, Contracts, PMCode, TradeID, StrategyID

    AssetClass05_NotClosed: AssetType, PortfolioCode, Identifier, Position, Description, Currency, ReferencePortfolioCode, TradeDate, PMCode, TradeID, StrategyID

    I try to read (excel 2007 - vba) the db via these sql codes:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    The first line of code works fine, second line produces an error:

    Run-time error '-2147467259 (80004005)':
    Method 'Open' of object '_Recordset' failed


    I am using ADODB, the error occurs in this line:

    Please Login or Register  to view this content.
    Why the second command crashes? The commands structures are similar.

    Thanks for any help,
    Lloyd

  2. #2
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Any ideas?

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Lloyd

    One line of code isn't much to go on.

    Can you post the rest of the code?

    Then at least we can see how you've defined sql and ADOC.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi Norie,

    I am sorry, sure this makes it easier:

    Please Login or Register  to view this content.
    Lloyd

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Is it only the 2nd query that you have probems with?

    Do both queries work when you copy the SQL used in the code and test in the database?

  6. #6
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Yes, by reading the db from excel, only the 2nd query crashes.

    By executing both sql-statements in access there is no problem.

  7. #7
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Any ideas?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    I don't see anything wrong with the SQL, though I would probably have used a join on TradeID to link the table rather than having TradeID in the criteria.

    The error message is, as usual, not particularly helpful.

    I even tried a search on that and the only database specific result involved violation of the primary key when inserting new data.

    How are you calling the function when trying to run the queries?

  9. #9
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi Norie,

    I'm not sure that you mean, this is the code around the function call:

    Please Login or Register  to view this content.
    Lloyd

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Lloyd

    That's what I was looking for and all the queries look fine.

    Did you actually copy and test the SQL passed to the function?

  11. #11
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi Norie,

    yes I did. It works fine!

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Ok, so everything is solved.

  13. #13
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi Norie,

    no, you got me wrong!

    I copied the conents of sql from
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    into access and excuted it maually. this works fine. By calling the statement from excel, the query still crashes.

    Llloyd

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    My general rule of thumb when debugging sql from Excel is start with the dates. It might not be the culprit in this case, but it's always an easy thing to rule out and it can cause to iffy errors, be explicit in passing your dates - I don't know what your date function does, but it looks dodgy -either way, pass your dates as strings and format them as yyyy-mm-dd, so
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Hi Kyle,

    just for testing I have removed the restriction with the date:

    Please Login or Register  to view this content.
    The error still occurs!

    redDate just lags the actual date:

    Please Login or Register  to view this content.
    Lloyd

  16. #16
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Try changing:
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Kyle

    I take it Position is reserved?

    Keep on forgetting how many reserved words there are in SQL.

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    It depends on the version of Jet you are using and whether it's being run in ANSI or non-ANSI mode - must admit I had to look this one up - I didn't know it; but I tend to play safe with my field names and always have a 3 letter prefix anyway that relates to the table when naming them, prevents issues like these and make it easy to identify tables/fields in complex queries.

    I never use access these days, strictly sql server

    P.s I found the list here http://support.microsoft.com/kb/248738/EN-US

  19. #19
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Run-time error '-2147467259 (80004005)' / unable to locate problem

    Yep, that's it.

    Norie, Kyle, thank you very, very much!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Run-time error '-2147467259(80004005)'
    By Lloyd Blankfein in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-14-2013, 01:52 PM
  2. Excel 2010 Run Time Error '-2147467259 (80004005)'
    By jdpeterson72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 06:52 PM
  3. [SOLVED] Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  4. [SOLVED] Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel General
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM
  5. Run time error '-2147467259 (80004005) adding icon
    By DMc2005 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2005, 12:05 PM

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