Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2014, 03:07 PM
delphimpd delphimpd is offline
Senior Member
 
Join Date: Oct 2006
Posts: 701
Default A Procedure Compiler Error

Hi All and thanks very much for the help in advanced

Not so familiar with this, a little out of shape I guess.

What I am trying to accomplish is the following:

I have about 50 DB check box controls which when the form is open I register on a variable the value of each checkbox control, and if the user makes a change it will insert the previous value and the new value into a memo field (A Kind of Auditing methods when someone changes values of the check box).

I don't want to re code each control with various things, instead I want to create a procedure, then call the procedure from each control.

Here is the Procedure (Thanks so much for the Help)

When I call the procedure from the OnClick event from the DBCheckBox I get a "Not enough actual parameters" error from the Compiler.

I call the procedure like this

getCheckValue;



Code:
procedure getCheckValue(sender : TObject);
 var
varChecked : string;
varSender: tsdbCheckBox;
varVariable_Holding_Value : string;
varSender_Data_Field : string;
begin
  varSender := Sender as tsdbCheckBox;

  varSender_Data_Field := varSender.DataField;
  varVariable_Holding_Value := 'VAR_'+varSender_Data_Field;

    if varSender.ValueChecked = 'Yes' then
    begin
       varChecked := 'Yes';
    end
    else
    begin
       varChecked := 'No';
    end;

     if frmProgram_Users.qryUsers.State in [dsEdit] then
      begin
           frmProgram_Users.memoUsers_Update_Audit.Lines.add('   ');
           frmProgram_Users.memoUsers_Update_Audit.Lines.add('**** '+varSender.Caption+' was edited from'+varVariable_Holding_Value+' To: '+varChecked);
           frmProgram_Users.memoUsers_Update_Audit.Lines.add('**** Edited on '+FormatDateTime('MM/DD/YY HH:NN', Now)+' ****');
           frmProgram_Users.memoUsers_Update_Audit.Lines.add('**** Edited By '+frmMain.qryUser.FieldByName('USER_NAME').AsString+' Id:'+frmMain.qryUser.FieldByName('USER_ID').AsString+'  ****');
           frmProgram_Users.memoUsers_Update_Audit.Lines.add('   ');
      end;

 end;

Best regards,
Reply With Quote
  #2  
Old 02-14-2014, 03:19 PM
kolbasz kolbasz is offline
Senior Member
 
Join Date: Nov 2013
Posts: 841
Default

procedure TForm1.DBCheckBox1Click(Sender: TObject);
begin
getCheckValue(Sender);
end;
Reply With Quote
  #3  
Old 02-14-2014, 03:48 PM
delphimpd delphimpd is offline
Senior Member
 
Join Date: Oct 2006
Posts: 701
Default

Thanks Kolbasz for the help. That worked.

Best regards
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 06:01 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.