Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Database Code Help

alejitroalejitro Member Posts: 1
Hi People

I'm new in database programming, i have an Access database and i'm trying to eliminate some records in a table, here is the code

Table6->First();
for(int i=0;iRecordCount;i++){
placa=Table6->FieldByName("Placa")->AsString;
tiempo=Table6->FieldByName("Tiempo")->AsString.ToDouble();
for(int j=0;jRecordCount;j++){
Table6->First();
Table6->MoveBy(j);
placa2=Table6->FieldByName("Placa")->AsString;
tiempo1=Table6->FieldByName("Tiempo")->AsString.ToDouble();
if(placa==placa2){
if(tiempoLocate("Tiempo",valor,Opts);
Table6->Delete();
Table6->Refresh();
}
if(tiempo1<=tiempo){
valor = Variant(tiempo);
Table6->Locate("Tiempo",valor,Opts);
Table6->Delete();
Table6->Refresh();
}
}
}
Table6->First();
Table6->MoveBy(i);
}

The idea is when placa=placa2 make a comparison of the field "Tiempo"
if the time of placa is less than time of placa2 the record that must be delete is placa2 else, the record must be delete it placa, i don't know what's the error here, i'll be very grateful if you can help me.

Alejandro
Sign In or Register to comment.