Share via

Compare value in previous record

Anonymous
2010-07-28T13:27:27+00:00

Is it possible on a form to compare a value between the current record and the previous record (not all previous records just the one before)

I am aiming for something like this

when moving through the records if the value in current record field1 = to the value in field1 the previous record then update current record field2 with the value from previous record field2 otherwise update the current record field2 with the value from the previous record field2+1

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2010-07-28T14:52:58+00:00

    You said the same thing as in your original question.  I need to know when current field2 should not be changedfor the case where current field1 is not = previous field1.

    Think about a scenario where you click on record 1, then click on record 2, then click on record record 1 again and click on record 2 again.  Then explain what should happen to field 2 each time you click on record 2.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-28T13:44:25+00:00

    What I want to do for example in record 1 is set the value in field2 to 1 then when I hit enter and it moves to the next record it will check to see if the value in field1 current record is the same as the value in field1 the previous record. If it is then set the value in field2 the current record to the same value as field2 the previous record. If the value in field1 the current record is not the same as field1 the previous record then set the value of field 2 current record to field2 previous record +1

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-07-28T13:40:08+00:00

    Lots of things are possible using some VBA code, but I'm having trouble figuring out how this majes sense.  If current field1 is not = previous field1, then every time you "moving through the records", current field2 is incremented won't do anything except count how many times you move through the record.  Seems like you need additional conditions about when to change current field2 so it doesn't get incremented over and over.

    Was this answer helpful?

    0 comments No comments