Click to See Complete Forum and Search --> : Problem using MSHFlexGrid


jrizzo
October 23rd, 2001, 03:12 PM
I am trying to use the MSHFlexGrid control in VBA, and I'm having quite a hard time with it. I attempted to copy & modify a microsoft example, but it doesn't seem to work:

Dim strConnect As String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFileName & ";Persist Security Info=False"

Dim strSh As String
strSh = "SHAPE {SELECT * FROM `dt_field_sample`}" & _
"APPEND ({SELECT * FROM `dt_results`} RELATE " & _
"sys_loc_code TO sys_loc_code)"

UserForm2.Adodc1.ConnectionString = strConnect
UserForm2.Adodc1.RecordSource = strSh
Set UserForm2.MSHFlexGrid1.DataSource = UserForm2.Adodc1


At this point, I get the error message:
"Invalid SQL statement; Expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'


Can somebody please tell me what I'm doing wrong? I know it's probably something simple, but I guess I just don't know what I'm doing ;-)
The connection is fine - if I use ordinary SQL, the table shows up, but I need to use SHAPE to build a heirarchy...

Thanks,

Jon