Microsoft Access help..

Discussion in 'OT Technology' started by EPD Hater, Mar 29, 2003.

  1. EPD Hater

    EPD Hater New Member

    Joined:
    Aug 26, 2001
    Messages:
    538
    Likes Received:
    0
    For a default value in a table, how can I word an expression to take the previous/last value in the same column and assign it to the current row in that same column?

    For example, I want someone to enter a value in column C and when the user hits enter to go to the next row, that column C in that new row will be assigned the value of what was entered in column C in the now-previous row.

    Any input appreciated other than googling, I've tried it.
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    There's lots of ways to do this, but they all require some VBA work.

    I think the easiest would be to create an On AfterUpdate event with this code:

    ColumnCFieldName.defaultvalue = ColumnCFieldName

    This of course requires a form to be used for data entry.
     
  3. EPD Hater

    EPD Hater New Member

    Joined:
    Aug 26, 2001
    Messages:
    538
    Likes Received:
    0
    Ok, I'll try that. I've actually made a form for data-entry to make it user-friendly, so I'll mess with it, thanks :)
     
  4. EPD Hater

    EPD Hater New Member

    Joined:
    Aug 26, 2001
    Messages:
    538
    Likes Received:
    0
    Ok, it works, but only if the Column C is a number. I'm no VB person, but I declared column C as a string now in the VB code, and it gives me an error of "Invalid Qualifier" for

    ColumnC.DefaultValue = ColumnC
     
  5. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Change it to

    """" & columnc & """"
     
  6. EPD Hater

    EPD Hater New Member

    Joined:
    Aug 26, 2001
    Messages:
    538
    Likes Received:
    0
    you're a saviour, thanks!
     
  7. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA

Share This Page