Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    previous record data to new record (Access '97)

    How do I get data from a field ([weight after]) to transfer to a different field ([weight before]) after I have executed a "Add Record". The form remains the same with the updated field data.
    Present Record "add record" New record
    ex. field1 [weightbefore] field.[weightbefore] is previous record [weightafter]
    field2 [weightafter] field2.[weightafter]

    I hope this makes sense, thanks in advance for your help..

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: previous record data to new record (Access '97)

    You must do this in the form. In the BeforeInsert event of the form, put code like the following:

    Dim varValue
    varValue = DLast("[Weight After]", "tblWeights")
    If Not IsNull(varValue) Then
    [Weight Before] = varValue
    End If

    You must replace tblWeights by the name of the appropriate table (or query). I have assumed that your table has a primary key; otherwise DLast may not return the correct value. The If construction is meant to prevent an error if no record exists yet.

  3. #3
    New Lounger
    Join Date
    Sep 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: previous record data to new record (Access '97)

    Hans, Thank you very much! -Sir, it worked like a charm. Compared to what I was told by another associate, yours was short, simple and it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •