(4 replies, posted in SQL queries)

How about VALUES instead of VALUE?

    SQLExecute('INSERT INTO dtClientName(NACommunication1) VALUES ("'+fmNeedsAssessment.NACommunicationText1.Text+'")WHERE id='+fmClientSearh.TableGrid1.sqlValue);

VALUES is a key word, it does not get singular if you insert only one value wink

Is there a more secure way to connect to a SQL Server, everything is readable in the script file. Could it be possible to connect using ODBC connection directly so it is not hard coded?


(4 replies, posted in General)

Thanks pavlenko.vladimir.v, I was not looking at the right place roll big_smile


(4 replies, posted in General)

It looks like it in the Russian section but that does not change the fact that we must abide to the license agreement to use it. I remember having seen one popping up during the very first install but cannot find it to read it in full.


(4 replies, posted in General)


I am looking for the MVDB license agreement that I can't seem to find anywhere. I would like to know a bit more about commercial distribution of products made using MVDB. I do have a lifetime license.


(7 replies, posted in Talks about all)

Ca serait plus facile si tu joignais un zip de ton projet sans l'executable dedans. Même un petit morceau du projet suffit si tu veux garder le projet confidentiel. Il y a plusieurs moyens d'arriver à ce que tu veux mais les bénévoles du forum n'ont pas forcément le temps de travailler pour les autres wink

Thanks for the explanation and whoooo that's a nice script to modify the caption of... almost anything!!
It is best for the final user to know what he/she is actually working on.

I guess your snippet manager might be quite consequent given all the tips you know!      wink

Thanks Derek, I have been away for too long from MVDB,  I forgot how to work with it :rolleyes

The calculated fields are a very good addition.

I just wonder why and how is the footer displayed at the bottom of Form1.TableGrid1 in your project as I don't spot any script or property for that and if there is a way of managing it like adding some wording changing the font etc...


(2 replies, posted in Script)

I tried something similar from a Delphi website but MVDB does not recognize DWORD (unknown type:'DWORD') and it does not recognize PChar either...

Yeah... except that the button show records does not allow for a lot of liberty, you must select whether a grid or a combobox which none of them are present in form where the ADD is called from, hence my request.

Anyway, I found a way of doing it with a single line of script instead of multiple lines which is not too bad. I wish the GUI "Show Record" button had more flexibility.

The Add button must not have any action but must have an On Click event and the script is as follow:

procedure Admin_addMaint_OnClick (Sender: TObject; var Cancel: boolean);

Syntax is ShowRecord(Target form name,'Source table name',Source form and object where dbItemID is acquired from);

AND the fields where you record the data in the target table must match the name of the original FieldNames otherwise you get an error about column names!!

If someone has a better way, please share!!

But I don't get how to carry infos from one form to another when clicking on a button...


(2 replies, posted in Script)

I just noticed that using the function GetUserName does not get the full username but the name of the folder containing the profile of the user. Is there a way to get the real full windows user name as displayed in the Windows Info (Windows 11)

That is a correct statement, I will go back to design. Thanks Derek.

I do have another complication and I am scratching my head to see which solution would save me to write tons of scripts to do this.

The attached project is a very very simple version of what I am working on, I need to get some fields from a form opened via a "show record" to be transferred to a new form and then saved into a different table. I know I can do it via scripts but I want to know if there would be a simple solution that I don't see yet. There is a screenshot in the zip file for the details.

I don't mind using tabs but that would prove pretty difficult to implement in my current big project.

Is it possible to set the default value of a TextBox directly in the object property to match an existing value in an object from another form or do we have to write a script?


Sparrow, you are a chief!! That is so much more elegant than writing a SQL query and much more effective!!

I fixed question 3, I just forgot to put a "begin-end;" after the else... stupid me!
The reasoning behind the request is to force a chain of events before giving the opportunity of choosing a new return date, a computer being in status "To be restaged" must be restaged, then delivered. In my full app, I do have a delivery date field and all actions are logged for full tracking.

The whole purpose of the script is to avoid data entry errors as much as possible

Final script looks like this, I am going to fine tune it but this one works as expected!

  status: integer;

procedure Admin_OnClose (Sender: TObject; Action: string);
  Admin.StatusList.dbFilter:= '';

procedure Admin_OnShow (Sender: TObject; Action: string);
  status := Admin.StatusList.dbItemID;

     if Admin.StatusList.sqlValue='4' then
       Admin.StatusList.dbFilter:= 'id<=4'; // locks status list to only 3 choices
       Admin.ReturnDate.Enabled:= False;  // disable date picker
       if Admin.StatusList.sqlValue='6' then
       Admin.ReturnDate.Enabled:= True; // enable date picker

procedure Admin_ReturnDate_OnChange (Sender: TObject);
  if Admin.ReturnDate.checked then
       Admin.StatusList.dbFilter:= 'id=4';
       Admin.StatusList.dbItemID:= 4;
    end else
       Admin.StatusList.dbFilter:= '';
       Admin.StatusList.dbItemID:= status;



Thanks it is partially fixed, there is still this annoying empty status if you check a return date and then uncheck it straight away. Funny how it is easy to instantly change the status when choosing a date but difficult to revert when unchecking it before saving.

The only solution I found was to enter a sql query after the "else" to get the current id but I wonder if it could be done via an object property since, it resets when closing the form.

I agree, it is not easy to understand, I am attaching an example of what I want to do with a pdf in the zip file.


I am a bit stuck with a script I want to implement to limit the list displayed in a combobox based on a checkbox in another field.

What I managed to do is actually to limit the content of the limit based on the status of the checkbox but, where I struggle is to display the current value and normal list if the checkbox is not checked.

Let's say I have a combobox pointing to 6 status. Normally this combobox displays the current status in database and if I drop it, I see all other status.

Now, I am automating a process where if I check a checkbox in a time picker, this status automatically displays status 4 and droplist is only status 4.

Problem is when I uncheck this box, I want to reset the combobox to where it should be with current status and all other status.

Current script looks like this:

procedure Admin_ReturnDate_OnChange (Sender: TObject);
    if Admin.ReturnDate.Checked= True then
       Admin.StatusList.dbFilter:= 'id=4';
       Admin.StatusList.dbItemID:= 4;
       Admin.StatusList.dbUpdate; // This works perfectly
       Admin.StatusList.dbFilter:= 'id'; // This clears the combobox but list all possible status


(3 replies, posted in Script)

Just don't forget to add a space before continuing the query on a new line otherwise except after a coma or you will get an error.

It should look like:

'SELECT namefields FROM table '+
' WHERE ... AND '+
' ...AND '+
'  ... ORDER BY ... '


(3 replies, posted in Script)

Thanks Sparrow!


(3 replies, posted in Script)

Is there a way to write multiline SQL queries within the script editor? It becomes easily difficult to follow a pretty long query.

I would like to be able to write

'SELECT columns
FROM table
JOIN table2 on tableid=table2id
WHERE condition='my condition'
AND second_condition='my second condition'
AND third condition="'+fieldObject.txt+'";'


Thanks Derek, you pointed the right thing about the variable tpcname, I was using:

tPCName := form1.edit1.sqlValue;

and it was wrong as this was retrieving an empty value returning empty results when using the proper sql query, hence my difficulties in trying to get it right by rewriting the query in many different ways!

This the working query

tPCName := Admin.EditPCName.text;

Computer_History.GridHisto.dbSQL:='SELECT * from Logs where Old_PC_Name="'+tPCName+'" or New_PC_Name="'+tPCName+'" and src="Computers"';


if I write it this way:

Computer_History.GridHisto.dbSQLExecute('SELECT * from Logs where Old_PC_Name="'+tPCName+'" or New_PC_Name="'+tPCName+'" and src="Computers"');

The compiler says: "Too many actual parameters at "356:43" (the location right behind dbSQLexecute and before opening the first parenthesis)

This is what drove me nuts in the first place!

Hi guys,

I feel super dumb but I can't get my head around this very simple yet super annoying issue.

I've got this query in a script but the compiler is insulting me when I try to compile with too many arguments or the location of a ";" ,etc..

I have tried many combinations but I really miss how it should be written.

The value tPCName is retrieved from a text field in a form.

'SELECT * from Logs where Old_PC_Name='+tPCName+' or New_PC_Name='+tPCName+' and src='Computers';';   

This one is telling me the ";" is expected right before Computers like this:

'SELECT * from Logs where Old_PC_Name='+tPCName+' or New_PC_Name='+tPCName+' and src=';Computers';';


(184 replies, posted in General)

AD1408 wrote:

Desprately looking for.......

App. custom exe icon applied via form1 properties

Do you think this could happen one day? Using a custom .ico file via a property for the forms?