thanks for the reply. doing a Tablegrid delete makes it more robust, id probably post on how to do it in the future so you saved both of us some time thanks again
2 2022-03-25 13:41:39
Topic: Delete All Rows...then Auto Query (4 replies, posted in Script)
i want to delete all rows in table (not the table). From a Button I use the Action, 'SQL Query', "Delete FROM userAnswers";
if i select the 2 table options below i get this error (see attachment).
i also get the same errors if i run it directly from a Script.
form1.tablegrid2.dbSQL := 'Delete From userAnswers';
form1.tablegrid2.dbSQLExecute;
If i leave these 2 options blank, no error and the data rows ARE deleted from db Table... BUT the TableGrid2 component doesnt run the Auto Query
even though the db Table doesnt have data, I still want to Column Names to appear in my TableGrid.
i did OnClick precedure from the same Button and ran
if Form1.TableGrid2.dbSQL <> '' then Form1.TableGrid2.dbSQLExecute;
but still same result, doesnt auto update
what the best solution? thanks
3 2022-03-25 00:30:08
Re: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
both methods work.
thanks for the quick replies
4 2022-03-24 17:24:36
Re: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
procedure checkBoxTest (Sender: TObject);
regarding the proceduer you provided... it works as expected but need to add another functionality...
i have the Submit button below the checkboxes. The submit button saves the choice to the database AND i also want to reset the checkboxes to Unchecked... i tried several ways but it seems the Checked Box cannot be UnChecked (at least I cant)
i tried the same looping Components as an OnClick for the submit button but cannot get it to work.
Given this procedure you provided. If I press the Submit button how can I reset all the CheckBoxes to Unchecked?
for i:=0 to Form2.ComponentCount-1 do
if TdbCheckBox(Form2.Components[i] is TdbCheckBox) then
if tdbCheckbox(form2.components[i]).State = cbChecked then
tdbCheckbox(form2.components[i]).State = cbUnchecked;
attached is the program. thanks for the help
5 2022-03-22 12:43:40
Re: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
thanks, it makes sense now...
wish there was a way to give a thumbs up or mark as solved. no big deal thought
6 2022-03-21 15:51:02
Re: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
quick question regarding the procedure
i see Sendeer alot within the script... TdbCheckBox(Sender)
how do i interpret 'Sender'. thnaks
7 2022-03-21 14:39:39
Re: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
procedure checkBoxTest (Sender: TObject);
thank you for the reply, it works great.
8 2022-03-20 16:33:42
Topic: 4 Checkboxes, have only 1 selected (12 replies, posted in Script)
Hello, i have 4 checkboxes and I only want to be able to select 1 of the 4. So if i select checkbox 1 then I select checkbox 2, checkbox 1 will automatically deselect.
here is the project attached. i wrote a seperate 'Onclick' for each checkbox but i cant get it to work, any ideas?
\\sample procedure
procedure Two_form2_CheckBox2 (Sender: TObject);
begin
Sleep(300);
form2.Checkbox1.State := cbUnchecked;
form2.CheckBox3.State := cbUnchecked;
form2.CheckBox4.State := cbUnchecked;
end;