OLAP |
Option Compare Database Sub OLAP() Dim Cn As Object Dim As Object Dim Access As Object Set Cn = CreateObject("ADODB.Connection") Cn.ConnectionString = "Provider=MSOLAP.3;" & _ "Integrated Security=SSPI;" & _ "Persist Security Info=True;" & _ "Initial Catalog=profit;" & _ "Data Source=.......................;" & _ "MDX Compatibility=1;" & _ "Safety Options=2;" & _ "MDX Missing Member Mode=Error" Cn.Open Set = CreateObject("ADODB.Recordset") Set .activeconnection = Cn .Source = "Select {} on 0, [].[].[] on 1 from profit" .Open Set Access = CreateObject("ADODB.Recordset") Access.Open "", CurrentProject.Connection If Not (.BOF = True And .EOF = True) Then .MoveFirst Do While Not .EOF Access.AddNew Access.Fields(0) = .Fields(0) .MoveNext Loop End If 'Set = Nothing 'Set Access = Nothing .Close Access.Close Cn.Close End Sub