Requery in AfterUpdate Event loads "old" Data ...

  • I'm working with Access 2000 / SQL 2K5 Express Backend.

    I got 2 different forms with subforms, with the same recordsource. Changing a field in one of the 2 forms should automatically update the accordingly field in the other form, if loaded. so far so good

    In the AfterUpdate event of each field in form A I call a procedure, which requeries the form B (and then jumps to the Record shown before). But obvioulsy, the data in the table is changed AFTER the after Update event, so in form B always the old data is shown.

    example:

    changing field in form A from "" to "test" --> field in form B shows ""

    then changing field in form A from "test" to "foo" --> field in form B shows "test" and so on ...

    I put MessageBoxes in the code of the procedure (which is called from the AfterUpdate procedures) showing the value of the corresponding field in the table: its always the old value, so of course form B only shows this value.

    What can I do? As I know, the AfterUpdate is the last event, when changing data ...

  • Hi, have you tried saving the record before requerying form B in the AfterUdate event?

  • Yeah, the problem is - as i figured out - that I'm using the AfterUpdate-event of the field, which occurs a bit to early.

    I should use the after update of the form, but this does not occur in every case, for example when changing the record. Changing the record leads to the Current-event for the form, but if I put the function call in both, Current and AfterUpdate, events than the program will loop endlessly (Current form A occurs --> function requeries form B --> Current for form B occurs -- function requeries form A --> Current form A occurs ...)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply