Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA SQL Query Table Error
    primarykey
    data
    text
    <p>I am trying to pull data from an ACD call data system, <code>Nortel Contact Center 6.0</code> to be exact, and if you use that particular system what I am trying to capture is the daily call by call data. However when I use this code</p> <p>(sCW is a common word string that equals <code>eCallByCallStat</code> and sDate is </p> <p><code>dDate = Format(Month(deffDate) &amp; "/" &amp; iStartDay &amp; "/" &amp; Year(deffDate), "mm/dd/yyyy")</code></p> <p><code>sDate = Format(dDate, "yyyymmdd")</code> )</p> <pre><code>sSql = "" sConn = "ODBC;DSN=Aus1S002;UID=somevaliduser;PWD=avalidpassword;SRVR=Thecorrectserver;DB=blue" sSql = "SELECT " &amp; sCW &amp; sDate &amp; ".Timestamp, " sSql = sSql &amp; sCW &amp; sDate &amp; ".CallEvent, " sSql = sSql &amp; sCW &amp; sDate &amp; ".CallEventName, " sSql = sSql &amp; sCW &amp; sDate &amp; ".CallID, " sSql = sSql &amp; sCW &amp; sDate &amp; ".TelsetLoginID, " sSql = sSql &amp; sCW &amp; sDate &amp; ".AssociatedData, " sSql = sSql &amp; sCW &amp; sDate &amp; ".Destination, " sSql = sSql &amp; sCW &amp; sDate &amp; ".EventData, " sSql = sSql &amp; sCW &amp; sDate &amp; ".Source, " sSql = sSql &amp; sCW &amp; sDate &amp; ".Time " &amp; vbCrLf sSql = sSql &amp; "FROM blue.dbo.eCallByCallStat" &amp; sDate &amp; " " &amp; sCW &amp; sDate &amp; vbCrLf sSql = sSql &amp; " ORDER BY " &amp; sCW &amp; sDate &amp; ".Timestamp" Set oQT = ActiveSheet.QueryTables.Add(Connection:=sConn, Destination:=Range("A1"), Sql:=sSql) oQT.Refresh BackgroundQuery:=False Do While oQT.Refreshing = True Loop" </code></pre> <p>When I run this I get an odd error message at oQT.Refresh BackgroundQuery:=False</p> <p>Oddly enough it worked for a month or so then just died</p> <hr> <p>@ loopo I actually added the <code>""</code> to the connection string and actually have the user name and password hard coded into the query with out quotes, I have since removed them for clarity in the posting</p> <hr> <p>The error I recieve is </p> <blockquote> <p>Run-time error '-2147417848(80010108)': Method 'Refresh" of Object "_QueryTable' Failed</p> </blockquote> <hr> <p>Thanks for your input Kevin. The Database is never in a state where no one is accessing it, it is a Call Handling system that is on 24 x 7 and always connected to is clients. At least that is my understanding. If I do this manually through Excel I never get an error, or have any issues only when I am doing this via a macro does it give me issues which lead me to think that it was my code causing the issue.</p> <p>I am connecting to the database via ODBC as recommended by the manuafacturer, but I wonder if they ever envisioned this sort of thing.</p> <p>I will see if I can leverage this into a .NET project and see if that helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload