VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MSHFlexGrid

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
399 Views, 7 Replies

MSHFlexGrid

Has anybody here ever used the MSHFlexGrid on a heirarchical recordset? I
am having a heck of a time with it. The MS documentation says to use SHAPE
to create the heirarchy, but this gives me an "Invalid SQL statement" error
message. Normally I would just use INNER JOIN, but that does not create a
heirarchy.

The example in the documentation uses SQL server, and I am using an MDB
file. I didn't think that should make a difference, but I can't figure out
what I am doing wrong. My code was just clipped right out of the MS docs
and modified for my program...

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

' Create a Shape command.
Dim strSh As String
strSh = "SHAPE {SELECT * FROM `dt_field_sample`} AS Samples APPEND ({SELECT
* FROM `dt_results`} AS Results RELATE sys_loc_code TO sys_loc_code) AS
Results"

MyForm.Adodc1.ConnectionString = strConnect
MyForm.Adodc1.RecordSource = strSh
Set MyForm.MSHFlexGrid1.DataSource = MyForm.Adodc1
MyForm.Show


Any suggestions? Please help!

Jon Rizzo
Langan Engineering and Environmental Services, Inc.
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Anonymous

Have you tried Refresh on your Adodc1 object after setting the RecordSource?

--
R. Robert Bell, MCSE
http://www.acadx.com


"Jon Rizzo" wrote in message
news:6F48401303895D0550DB25D07FE655F5@in.WebX.maYIadrTaRb...
| Has anybody here ever used the MSHFlexGrid on a heirarchical recordset? I
| am having a heck of a time with it. The MS documentation says to use
SHAPE
| to create the heirarchy, but this gives me an "Invalid SQL statement"
error
| message. Normally I would just use INNER JOIN, but that does not create a
| heirarchy.
|
| The example in the documentation uses SQL server, and I am using an MDB
| file. I didn't think that should make a difference, but I can't figure
out
| what I am doing wrong. My code was just clipped right out of the MS docs
| and modified for my program...
|
| Dim strConnect As String
| strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFileName
&
| ";Persist Security Info=False"
|
| ' Create a Shape command.
| Dim strSh As String
| strSh = "SHAPE {SELECT * FROM `dt_field_sample`} AS Samples APPEND
({SELECT
| * FROM `dt_results`} AS Results RELATE sys_loc_code TO sys_loc_code) AS
| Results"
|
| MyForm.Adodc1.ConnectionString = strConnect
| MyForm.Adodc1.RecordSource = strSh
| Set MyForm.MSHFlexGrid1.DataSource = MyForm.Adodc1
| MyForm.Show
|
|
| Any suggestions? Please help!
|
| Jon Rizzo
| Langan Engineering and Environmental Services, Inc.
|
|
Message 3 of 8
Anonymous
in reply to: Anonymous

Actually, the error occurs when I set the RecordSource, so it happens
before I would have the chance to refresh it.


"R. Robert Bell" wrote in message
news:5C7A7F5D76664210760F195D7F83FA6B@in.WebX.maYIadrTaRb...
> Have you tried Refresh on your Adodc1 object after setting the
RecordSource?
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
>
> "Jon Rizzo" wrote in message
> news:6F48401303895D0550DB25D07FE655F5@in.WebX.maYIadrTaRb...
> | Has anybody here ever used the MSHFlexGrid on a heirarchical recordset?
I
> | am having a heck of a time with it. The MS documentation says to use
> SHAPE
> | to create the heirarchy, but this gives me an "Invalid SQL statement"
> error
> | message. Normally I would just use INNER JOIN, but that does not create
a
> | heirarchy.
> |
> | The example in the documentation uses SQL server, and I am using an MDB
> | file. I didn't think that should make a difference, but I can't figure
> out
> | what I am doing wrong. My code was just clipped right out of the MS
docs
> | and modified for my program...
> |
> | Dim strConnect As String
> | strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
dbFileName
> &
> | ";Persist Security Info=False"
> |
> | ' Create a Shape command.
> | Dim strSh As String
> | strSh = "SHAPE {SELECT * FROM `dt_field_sample`} AS Samples APPEND
> ({SELECT
> | * FROM `dt_results`} AS Results RELATE sys_loc_code TO sys_loc_code) AS
> | Results"
> |
> | MyForm.Adodc1.ConnectionString = strConnect
> | MyForm.Adodc1.RecordSource = strSh
> | Set MyForm.MSHFlexGrid1.DataSource = MyForm.Adodc1
> | MyForm.Show
> |
> |
> | Any suggestions? Please help!
> |
> | Jon Rizzo
> | Langan Engineering and Environmental Services, Inc.
> |
> |
>
>
Message 4 of 8
Anonymous
in reply to: Anonymous

Oops, you *did* state that...

--
R. Robert Bell, MCSE
http://www.acadx.com


"Jon Rizzo" wrote in message
news:0643F8B3DE7206ECFF39B9D6EF77173C@in.WebX.maYIadrTaRb...
| Actually, the error occurs when I set the RecordSource, so it happens
| before I would have the chance to refresh it.
Message 5 of 8
Anonymous
in reply to: Anonymous

Have you considered using the DataGrid control instead?

--
R. Robert Bell, MCSE
http://www.acadx.com


"Jon Rizzo" wrote in message
news:0643F8B3DE7206ECFF39B9D6EF77173C@in.WebX.maYIadrTaRb...
| Actually, the error occurs when I set the RecordSource, so it happens
| before I would have the chance to refresh it.
|
|
| "R. Robert Bell" wrote in message
| news:5C7A7F5D76664210760F195D7F83FA6B@in.WebX.maYIadrTaRb...
| > Have you tried Refresh on your Adodc1 object after setting the
| RecordSource?
| >
| > --
| > R. Robert Bell, MCSE
| > http://www.acadx.com
| >
| >
| > "Jon Rizzo" wrote in message
| > news:6F48401303895D0550DB25D07FE655F5@in.WebX.maYIadrTaRb...
| > | Has anybody here ever used the MSHFlexGrid on a heirarchical
recordset?
| I
| > | am having a heck of a time with it. The MS documentation says to use
| > SHAPE
| > | to create the heirarchy, but this gives me an "Invalid SQL statement"
| > error
| > | message. Normally I would just use INNER JOIN, but that does not
create
| a
| > | heirarchy.
| > |
| > | The example in the documentation uses SQL server, and I am using an
MDB
| > | file. I didn't think that should make a difference, but I can't
figure
| > out
| > | what I am doing wrong. My code was just clipped right out of the MS
| docs
| > | and modified for my program...
| > |
| > | Dim strConnect As String
| > | strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
| dbFileName
| > &
| > | ";Persist Security Info=False"
| > |
| > | ' Create a Shape command.
| > | Dim strSh As String
| > | strSh = "SHAPE {SELECT * FROM `dt_field_sample`} AS Samples APPEND
| > ({SELECT
| > | * FROM `dt_results`} AS Results RELATE sys_loc_code TO sys_loc_code)
AS
| > | Results"
| > |
| > | MyForm.Adodc1.ConnectionString = strConnect
| > | MyForm.Adodc1.RecordSource = strSh
| > | Set MyForm.MSHFlexGrid1.DataSource = MyForm.Adodc1
| > | MyForm.Show
| > |
| > |
| > | Any suggestions? Please help!
| > |
| > | Jon Rizzo
| > | Langan Engineering and Environmental Services, Inc.
| > |
| > |
| >
| >
|
|
Message 6 of 8
Anonymous
in reply to: Anonymous

The problem is that I need to represent a heirarchy. ie: I have two tables.
For each item in one table, there are several related items in the other.
The only way I know of to show this "grouping" is to use the MSHFlexGrid
control. I don't think that the DataGrid control can't do this.

Is there another way?

Jon


"R. Robert Bell" wrote in message
news:1160BF4A549F3F037DC568C88AB6E0C8@in.WebX.maYIadrTaRb...
> Have you considered using the DataGrid control instead?
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
>
> "Jon Rizzo" wrote in message
> news:0643F8B3DE7206ECFF39B9D6EF77173C@in.WebX.maYIadrTaRb...
> | Actually, the error occurs when I set the RecordSource, so it happens
> | before I would have the chance to refresh it.
> |
> |
> | "R. Robert Bell" wrote in message
> | news:5C7A7F5D76664210760F195D7F83FA6B@in.WebX.maYIadrTaRb...
> | > Have you tried Refresh on your Adodc1 object after setting the
> | RecordSource?
> | >
> | > --
> | > R. Robert Bell, MCSE
> | > http://www.acadx.com
> | >
> | >
> | > "Jon Rizzo" wrote in message
> | > news:6F48401303895D0550DB25D07FE655F5@in.WebX.maYIadrTaRb...
> | > | Has anybody here ever used the MSHFlexGrid on a heirarchical
> recordset?
> | I
> | > | am having a heck of a time with it. The MS documentation says to
use
> | > SHAPE
> | > | to create the heirarchy, but this gives me an "Invalid SQL
statement"
> | > error
> | > | message. Normally I would just use INNER JOIN, but that does not
> create
> | a
> | > | heirarchy.
> | > |
> | > | The example in the documentation uses SQL server, and I am using an
> MDB
> | > | file. I didn't think that should make a difference, but I can't
> figure
> | > out
> | > | what I am doing wrong. My code was just clipped right out of the MS
> | docs
> | > | and modified for my program...
> | > |
> | > | Dim strConnect As String
> | > | strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> | dbFileName
> | > &
> | > | ";Persist Security Info=False"
> | > |
> | > | ' Create a Shape command.
> | > | Dim strSh As String
> | > | strSh = "SHAPE {SELECT * FROM `dt_field_sample`} AS Samples APPEND
> | > ({SELECT
> | > | * FROM `dt_results`} AS Results RELATE sys_loc_code TO
sys_loc_code)
> AS
> | > | Results"
> | > |
> | > | MyForm.Adodc1.ConnectionString = strConnect
> | > | MyForm.Adodc1.RecordSource = strSh
> | > | Set MyForm.MSHFlexGrid1.DataSource = MyForm.Adodc1
> | > | MyForm.Show
> | > |
> | > |
> | > | Any suggestions? Please help!
> | > |
> | > | Jon Rizzo
> | > | Langan Engineering and Environmental Services, Inc.
> | > |
> | > |
> | >
> | >
> |
> |
>
>
Message 7 of 8
Anonymous
in reply to: Anonymous

On Fri, 26 Oct 2001 06:09:39 -0700, "Jon Rizzo" wrote:

» Has anybody here ever used the MSHFlexGrid on a heirarchical recordset?

I haven't but I'll give it a shot.



Try changing this:

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


to something like this:

strConnect = "Provider=MSDataShape;Data Source=" & dbFileName & _
";Persist Security Info=False;Data Provider=Microsoft.Jet.OLEDB.4.0"


--
Paul Marshall
pmarshal@vulcraft-al.com
Message 8 of 8
Anonymous
in reply to: Anonymous

You hit the nail right on the head Paul - it works great now!

Thanks for your help.

Jon Rizzo
Langan Engineering and Environmental Services, Inc.


"Paul Marshall" wrote in message
news:hlejtt86n1cveuo2s3bovf8sb4l0skfunj@4ax.com...
> On Fri, 26 Oct 2001 06:09:39 -0700, "Jon Rizzo" wrote:
>
> » Has anybody here ever used the MSHFlexGrid on a heirarchical recordset?
>
> I haven't but I'll give it a shot.
>
>
>
> Try changing this:
>
> » strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
dbFileName &
> » ";Persist Security Info=False"
>
>
> to something like this:
>
> strConnect = "Provider=MSDataShape;Data Source=" & dbFileName & _
> ";Persist Security Info=False;Data Provider=Microsoft.Jet.OLEDB.4.0"
>
>
> --
> Paul Marshall
> pmarshal@vulcraft-al.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report