I want to compare two dates. I triied like this:
SetDates(Rec, StartDate2, EndDate2, Regelkorting);
BOMB.RESET;
BOMB.SETRANGE(StartDate2,StartDate2);
IF BOMB.FINDFIRST THEN BEGIN
IF BOMB.StartDate2 > BOMB.EndDate2 THEN BEGIN
ERROR('startdatum kan niet groter zijn dan einddatum');
END;
END
But there is no message showing
and this is the output:
BOM Component 530120,10000,Artikel,530120,Intergas 041107 HREco 24 CW3,ST,0,,,,,0,,0,,01-10-16,10-10-13,0,Nee,Nee,
Thank you
The comparation it's ok, but I think you are not finding the correct record of BOMB.
You have this:
BOMB.RESET;
BOMB.SETRANGE(StartDate2,StartDate2);
IF BOMB.FINDFIRST THEN BEGIN
IF BOMB.StartDate2 > BOMB.EndDate2 THEN BEGIN
ERROR('startdatum kan niet groter zijn dan einddatum');
END;
END;
You filter only by StartDate2
field and not for the primary key, so you find the wrong record.
So Filter BOMB Table for the fields of primary key, Standard BOM Component table have this primary key Parent Item No.,Line No.
if you didn't change this try this:
BOMB.RESET;
BOMB.SETRANGE("Parent Item No.", "Parent Item No.");
BOMB.SETRANGE("Line No.", "Line No.");
IF BOMB.FINDFIRST THEN BEGIN
IF BOMB.StartDate2 > BOMB.EndDate2 THEN BEGIN
ERROR('startdatum kan niet groter zijn dan einddatum');
END;
END;