[Solved] Run-time error -2147467259 (80004005) on VBA macro


I am putting solution here, which worked for me. In other similar post it was more over connectivity issue, but in my scenario it was one of the column in table i am trying to access. In my table i had column which is having timeStamp and that’s the column was causing above error, when i removed or used formatting for that column it worked without exception. I wonder if this error would have been more explanatory, as i spend time on trying other stuff instead of just fixing my SQL.

Solution:

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
    StrCon = "Driver={Microsoft ODBC for Oracle}; " & _
            "CONNECTSTRING=(DESCRIPTION=" & _
            "(ADDRESS=(PROTOCOL=TCP)" & _
            "(HOST=dhotname)(PORT=1521))" & _
            "(CONNECT_DATA=(SERVICE_NAME=APSQ))); uid=username; pwd=password;"
cn.Open (StrCon)
vSQL = "select request_id,user_name from request" 
rs.Open vSQL, cn

Now if you look at above example i have specified exact column names, the issue here was REC_DT column which had time value. Either you can convert that value or remove column, for me that value was not required so just removed from my SQL and it worked.

enter image description here

solved Run-time error -2147467259 (80004005) on VBA macro