I am trying to create a local olap cube ,populating data from access database.

On executing the code , I am getting an error, syntax error in column definition.

Could you pls tell me why this error is occuring. I have checked the column names in the database as well as the code.. They r the same..

Now , is there any other point I must look on.

Thanks in advance

Loydon
/////////////////////////////

Dim cnCube As ADODB.Connection
Dim s As String
Dim strProvider As String
Dim strDataSource As String
Dim strSourceDSN As String
Dim strSourceDSNSuffix As String
Dim strCreateCube As String
Dim strInsertInto As String

On Error GoTo Error_cmdCreateCubeFromDatabase_Click


strProvider = "PROVIDER=MSOLAP"

strDataSource = "DATA SOURCE=c:\OlapCube.cub"

strSourceDSN = "SOURCE_DSN=CubeAccess1"


strCreateCube = "CREATECUBE=CREATE CUBE cbia( "
strCreateCube = strCreateCube & "DIMENSION[STORE],"
strCreateCube = strCreateCube & "LEVEL[STORE Name],"
strCreateCube = strCreateCube & "MEASURE [STORE Sales] "
strCreateCube = strCreateCube & "Function Sum "
strCreateCube = strCreateCube & "Format '#.#')"

strInsertInto = strInsertInto & "INSERTINTO=INSERT INTO cbia( SSTORE.[STORE Name],"
strInsertInto = strInsertInto & "Measures.[STORE Sales])"

''''''''''''''''''''''''Table.Column Name''''''''''''''''''''''''
strInsertInto = strInsertInto & "SELECT SSTORE.STORE_NAME AS COL1 ,"
strInsertInto = strInsertInto & "SSTORE.STORE_SALES AS COL2"
strInsertInto = strInsertInto & "FROM [SSTORE]"

MsgBox strDataSource & "; "
MsgBox strSourceDSN & "; "
MsgBox strCreateCube & "; "
MsgBox strInsertInto & ";"

Set cnCube = New ADODB.Connection
s = strProvider & ";" & strDataSource & ";" & strSourceDSN & ";" & strCreateCube & ";" & strInsertInto & ";"

Screen.MousePointer = vbHourglass
cnCube.Open s
Screen.MousePointer = vbDefault
Exit Sub

Error_cmdCreateCubeFromDatabase_Click:
Screen.MousePointer = vbDefault
MsgBox Err.Description
If Err.Number <> 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
End If