View Single Post
Old Aug 19th, 2005, 9:22 AM   #28
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
Snakes shit other snakes...seriously...mine shits these little white balls but every month or so it shits this huge long crap!

Onto the topic though, lol...I'm pulling my hair out now! I've thought of every possibility. Ok, I enter an invalid ID and it goes straight to the else and says that the input is invalid.

For my test data I already have a shift for a particular user, their ID, Time in and date is in the record, the time out field is blank. So i've traced the code through with this user in mind and i cannot see whats going wrong. My code as it stands is:

procedure Tfrm_clock_In.btn_enterClick(Sender: TObject);
var
          Today:TDateTime;
          Executed:boolean;
begin
Executed:= false;
Today:= Date;
tbl_employees.Open;
tbl_employees.First;
Repeat
        if strtoint(Edit_Employee_ID.text) = tbl_employeesEmployee_ID.value then
           begin
                tbl_shift.Open;
                tbl_shift.First;
                repeat
                        if (strtoint(Edit_Employee_ID.text) = tbl_shiftEmployee_ID.value) and (tbl_shiftDate_.Value = Today) then
                           begin
                                if Datetostr(tbl_shiftTime_Out.value)='' then
                                        begin
                                                //sql to updae file with clock out time
                                                showmessage('Clocked Out');
                                                Executed:=true;
                                        end
                                else Tbl_shift.Next;
                           end
                        else tbl_shift.Next;
                Until (Executed=true) or (tbl_shift.Eof); //until record update or no shift found
           end
        else tbl_employees.Next;
Until (Executed=true) or (tbl_employees.Eof);

if tbl_employees.Eof then showmessage('Invalid User ID'); //if don't find a matching employee number then invalid

If tbl_shift.Eof then //if don't find a record to update then create new one
        begin
                //sql to create a new record
        end;
        
end;

Any ideas?
gj15987 is offline   Reply With Quote