[SOLVED] Multiple SQLite3 Tables lazarus / 16-Databases ---------------------------------------------------------------------- guest48180 · 2018-05-27 18:04 I have a SQLite3 db in a DBGrid with a Label below it on a form. One of the tables has three records, five fields each. One is a name field. What I'm trying to do is, either by clicking or scrolling, make the Label.caption := the name in the name field. Once I get this then I can use other tables to reflect data based on the name selected. This is just test stuff to meet that end. The only thing I've came up with is this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Label1.Caption:=DBGrid1.SelectedField.CurValue;But I have to hop from field to field (column to column) to get it to change. And then I get a segment fault when I end the program. I've tried everything I can think of before making this post. If you can send me off in the right direction, I'd appreciate you. Thanks. ---------------------------------------------------------------------- HeavyUser · 2018-05-27 18:31 Quote from: Landslyde on May 27, 2018, 08:04:16 pmI have a SQLite3 db in a DBGrid with a Label below it on a form. One of the tables has three records, five fields each. One is a name field. What I'm trying to do is, either by clicking or scrolling, make the Label.caption := the name in the name field. Once I get this then I can use other tables to reflect data based on the name selected. This is just test stuff to meet that end. The only thing I've came up with is this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Label1.Caption:=DBGrid1.SelectedField.CurValue;But I have to hop from field to field (column to column) to get it to change. And then I get a segment fault when I end the program. I've tried everything I can think of before making this post. If you can send me off in the right direction, I'd appreciate you. Thanks. you write an on after scroll event on the sqlquery and your code there for example Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.SQLQuery1AfterScroll(DataSet :TDataSet);begin  label1.Caption := DataSet.FieldByName('name').AsString;end; ---------------------------------------------------------------------- guest48180 · 2018-05-27 19:06 Thank you, HeavyUser. That's opens doors. ---------------------------------------------------------------------- mangakissa · 2018-05-28 06:39 That's only works if the SQLQuery is on the form and not on a datamodule. ---------------------------------------------------------------------- HeavyUser · 2018-05-28 07:51 Quote from: mangakissa on May 28, 2018, 08:39:22 amThat's only works if the SQLQuery is on the form and not on a datamodule. if you mean that the event handler needs access to the forms controls in order to work then yes you are write, if you mean that the event will not fire outside the form then no. As always discretion is required. ---------------------------------------------------------------------- guest48180 · 2018-05-28 13:45 Noted. ---------------------------------------------------------------------- guest48180 · 2018-05-29 18:57 Quote from: mangakissa on May 28, 2018, 08:39:22 amThat's only works if the SQLQuery is on the form and not on a datamodule. Indeed. I'm finding drawbacks when I use the DataModule. Gets in the way and messes up the good stuff.