I would like to be sure that if the table (in this case adotHours ) enters edit or paste mode and the user clicks the save button, but accidentally places the same value in the Hours column, as the message Please enter another value has already appeared, otherwise, if the user enters a different value, a different piece of code is used.
I tried the following method, but it does not work - no matter what the user enters the message Please enter another value .
procedure TfrmLabour.Button6Click(Sender: TObject); var i,j, t: String; begin Edit1.Text := adotHours['Hours']; j := Edit1.Text; adotHours.Post; Edit2.Text := adotHours['Hours']; t := Edit2.Text; if t = j then showmessage ('Please enter another value') else begin..... end;
while I know that this is not the most elegant code, I thought that after the value was sent to adotHours Hours via the connected DBgrid , if it was a different value before t would become the new value and therefore adotHours['Hours'] will be different and allow else begin . Suggestions?
source share