The final step in creating a local cube includes creating a Connection object from Microsoft® ActiveX® Data Objects (ADO) and opening the data source connection with the ADO Open method.
The code in this topic includes the Connection object and Open method. This code also completes the creation of the local cube (.cub) file.
'*-----------------------------------------------------
'* Note: Since the cube is not created anywhere, when the
'* connection object is opened the cube is built on
'* the fly with the information in the connection string.
'* Set a New ADODB Connection Object.
'* Create the cube by passing concatenated connection
'* string to Open method of the connection object.
'*-----------------------------------------------------
Set cnCube = New ADODB.Connection
s = strProvider & ";" & strDataSource & ";" & strSourceDSN & ";" & strCreateCube & ";" & strInsertInto & ";"
Screen.MousePointer = vbHourglass
cnCube.Open s
Screen.MousePointer = vbDefault
Exit Sub
Error_cmdCreateCubeFromDatabase:
Screen.MousePointer = vbDefault
MsgBox Err.Description