Ask Your Question
0

SOLVED: Read values from selected rows in a table control

asked 2019-03-29 09:52:52 +0200

Lyndhurst gravatar image

updated 2019-04-23 10:00:08 +0200

Hi,

I have been hitting a wall for days now with Table Controls selected records. I tried code from this thread I have found this OpenOffice question where the OP seems satisfied with the answers he received, but I am getting errors upon errors.

With Access2Base, I am able to loop through a list, and retrieve values of selected rows quite easily, but could not find this kind of method for table control.

Can anyone show a simple myForm, myTable example to retrieve column values from selected rows in the table whether it is in Lo Basic or Access2Base. Or, maybe quote some documentation offering one that I might have missed.

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-04-08 07:21:18 +0200

Ratslinger gravatar image

updated 2019-04-08 20:01:20 +0200

Hello,

Have finally gotten to this. Have attached a simple sample which displays a total of the last column for selected records.

The entire key here is getting the View of the table control so as to get the array of the selected records. For more information on the Model-View of controls see -> The Model-View Paradigm.

Once you have the array, obtain the array bounds and use in a loop, getting each record and, in this case, totaling the field data.

The macro is not long and have placed comments within.

Sample -------- GridSelection.odb

Please note, rows must be selected for this to work. Selecting fields in a rows is not a selection.

edit flag offensive delete link more

Comments

Thank you very much for taking the time. Your example is simple, straight to the point, and well commented. It is very helpful. I had used a workaround adding a 'select' boolean in some of my tables, but this was inelegant and very limited when working with more complex queries.

Lyndhurst gravatar imageLyndhurst ( 2019-04-23 10:06:53 +0200 )edit

@Lyndhurst

As you have been helped, please help others to know the question has been answered by clicking on the ✔ in upper left area of answer which satisfied the question.

Ratslinger gravatar imageRatslinger ( 2019-06-08 22:39:43 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-29 09:52:52 +0200

Seen: 188 times

Last updated: Apr 23