none
Auto-fill data with data one record above when creating a new record RRS feed

  • Question

  • Hi

    Is it possible (and if it is possible: how?) to auto-fill (in the example below) field E with the data of field D when I create a new record?

    Row 1
    Row 2
    Row 3
    Row 4
    A
    B
    C
    D = A+B-C
    E = D from the row above
    F
    G
    H = E+F-G
    Thursday, December 8, 2016 10:29 AM

All replies

  • Hi

    Is it possible (and if it is possible: how?) to auto-fill (in the example below) field E with the data of field D when I create a new record?

    Hi Domenic,

    I remember that I used a long time ago some short-key combination with Shift or Alt, but I forgot how it worked, and I can't find it anymore.

    In general I work in this way:

    - make a clone of the form's Recordset: Set clone_set = Me.RecordsetClone

    - Synchronize the sets: clone_set.Bookmark = Me.Recordset.Bookmark

    - step back one record: clone_set.MovePrevious

    - get the value of the field and assign: Me.ActiveControl = clone_set(Fieldname)

    - close the set: clone_set.Close

    Most important is you get the idea.

    You can wrap this in a Sub that is triggered by a clicking a command button. It is also possible to couple this to a short-key, but that is more complicated.

    Imb.

    Thursday, December 8, 2016 10:57 AM