Hej,
Jag har ett excelmacro som hämtar information ifrån vårt MPS-system (IFS).
Vi ska nu byta operativsystem från windows7 till windows10 och jag ska testa diverse macro och det visar sig att inga macro med ADODB-connection fungerar längre.
Se kod enligt nedan (funkar bra i windows7, men ej i windows10):
---------------------------------------------------------------------------------
Public Sub GetCustOrdLines()
Dim Recordset As ADODB.Recordset
Dim sQuery As String
Dim vSokResultat As Variant
Dim Connection As Object
'Anger typ av databaskoppling
Set Connection = CreateObject("ADODB.Connection")
'Öppnar kopplingen till databasen
Connection.Open ("DRIVER={Microsoft ODBC for Oracle};UID=UserName;PWD=Password;SERVER=Servername;")
Set Recordset = New ADODB.Recordset
'Definierar SQL-frågan till MPS:en
sQuery = "select a.order_no, a.order_id, a.customer_no, ifsapp.Cust_Ord_Customer_API.Get_Name(a.CUSTOMER_NO), d.project_id, " & _
" ifsapp.Project_API.Get_Name(d.PROJECT_ID),c.manager, a.authorize_code, " & _
" ifsapp.ACTIVITY_API.Get_Activity_No(d.ACTIVITY_SEQ),ifsapp.ACTIVITY_API.Get_Description(d.ACTIVITY_SEQ), d.activity_seq, " & _
" d.target_date , d.planned_due_date, d.wanted_delivery_date, d.part_no, d.catalog_desc, d.desired_qty, d.line_state " & _
" from ifsapp.customer_order a, " & _
" ifsapp.project c, " & _
" ifsapp.customer_order_join d" & _
" where a.order_no = d.order_no" & _
" and d.project_id = c.project_id" & _
" and upper(d.LINE_STATE) <> upper( 'Cancelled' )" & _
" and upper(d.LINE_STATE) <> upper( 'Delivered' )" & _
" and upper(d.LINE_STATE) <> upper( 'Invoiced/Closed' )" & _
" order by d.planned_due_date"
'Ställer frågan till MPS:es
Recordset.Open Source:=sQuery, ActiveConnection:=Connection
'Lägger över resultatet i variabeln SokResultat
If Not Recordset.EOF = True Then
vSokResultat = Recordset.GetRows
End If
Recordset.Close
' Stänger kopplingen till databasen
Connection.Close
End Sub
----------------------------------------------------------------------
Macrot stannar vid "Connection.open" och då kommer följande felmeddelande:
--------------------------------------------------------------------------------------------
Run-time error '-2147467259 (80004005)':
[Microsoft][ODBC driver for Oracle][Oracle] Error while trying to retrieve text for error ORA-01019
-----------------------------------------------------------------------------------------------
Vad kan det bero på? Har ni någon idé?
Mvh
Mattias