enjoyit
2016-03-24T12:59:52Z
Hi there again,

is it possible to add a Rowkey automatically when populating the grid via FillfromRS?

In my example I would use the first column of my recordset for the Rowkey Information.

regards...
Igor/10Tec
2016-03-25T06:59:18Z
The FillFromRS method has the optional vRowKeyField parameter you can use for this purpose.
enjoyit
2016-03-29T12:37:45Z
Hi Igor,

thanks for your reply!

If I use this parameter I get the following error-message while creatig the grid:

"-2147220990 Invalid procedure call or argument"

The values of my ID-Field starting with 1 and ending with 145, if this Information is helpful for you.

my record is a adodb-recordset coming from an stored procedure.

regards...
Igor/10Tec
2016-03-29T15:07:48Z
May your recordset have duplicate row key values? If not, can you send us a sample we can use to reproduce the problem?
enjoyit
2016-03-30T09:17:52Z
Hi Igor,

there are no duplicate row keys...

you will find an example attached to this post

regards...

  test.zip (45kb) downloaded 64 time(s).
Igor/10Tec
2016-03-31T07:18:55Z
I have examined your sample and fixed some problems in it.

First, I found that the cached iGrid reference (lf_object_suche) may be empty when you try to pass it as a parameter to the func_iGrid_aufbauen sub:

test.accdb_problem.png

Click to View Image71 View(s)



You should not use the 'On Error GoTo error_handler' statement in your subs while debugging the app. If you commented this out, you would have seen that the problem you reported is not in iGrid's FillfromRS method. You simply tried to call the BeginUpdate method for the reference containing 'Nothing' in func_iGrid_aufbauen.

Another problem part of code was this statement:

lf_object.FillFromRS adorec_rs, igFillRSColsIfEmptyAndRows, adorec_rs(0)

It's not obvious, but the problem is in the last parameter. According to the iGrid documentation, this parameter should contain "the name of the field in the RS recordset used to populate the row keys in iGrid". In fact you passed a whole ADODB Field object, but iGrid expected just its string name:

lf_object.FillFromRS adorec_rs, igFillRSColsIfEmptyAndRows, adorec_rs(0).Name

And one more strange thing I found is that your query from the query does not work. At least, iGrid cannot enumerate its rows. So I changed the line

adorec.Open "SELECT * FROM qry_test", CurrentProject.Connection[/code] 

to

[code=vb]adorec.Open "SELECT DISTINCT table.ID_THEMA, table.FK_ID_UNTERNEHMEN FROM [table];", CurrentProject.Connection

, and saw the proper result in the form.

A glitch in MS Access/ADODB? Or maybe, this is a very complex construction for the universal implementation of the FillFromRS method that can enumerate various types of ADO and even DAO recordstes?

In any case, here is the working version of the sample flavored with my comments:

  test2.zip (29kb) downloaded 58 time(s).
enjoyit
2016-03-31T07:51:22Z
Hi Igor, thank you for your help!

The interesting thing is that my example works too when i don't use the rowkey parameter (when just remove the adorec(0) part of the fillfromrs function).

Nevertheless THANK YOU :)

Great support!