Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009

    Unanswered: Cell value changed event

    i have a problem and I hope you will be able to help me.
    i have two columns in a table in an access database.
    If i modify the value in a cell in column A i want a, for the same row, a cell in column B to modify. (making column B not editable is a plus)
    i hope this is clear enough and thank you in advance!

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    How do you intend to modify the value in column A, directly in the table, in a query, in a form? And what's the definition of your table? You need to clarify this if you want a precise answer.

    Have a nice day!

  3. #3
    Join Date
    Mar 2009
    i want to modify directly in the table
    i don't think it matters what type the cell have
    but for my problem i have two dates
    i add a date in column A and then it fills the column B automatically with data from column A + two years

  4. #4
    Join Date
    Sep 2005
    a better choice is probably to store only the date in col A.

    Since col B is always a calculated value you simply calculate it when you need to use it in a query, report, etc.

  5. #5
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Newblu has the right idea! There is seldom (although I won't say never) a reason to store a calculated field in a table.Tables have no events, so I don't think you can do this kind of thing directly in a table. Also, data entry should never be done directly into a table. It's a sure fire path to data corruption.

    If you create a query, based on your table, you can include a calculated field like this:

    SecondDate: DateAdd(“yyyy”,2,[FirstDate])

    Basing forms/reports on this query and using the calculated field SecondDate will always give you the FirstDate plus two years.

    If you want to do this in the form, something like this willl work:
    Private Sub FirstDate_AfterUpdate()
      If Not IsNull(Me.FirstDate) Then
        Me.SecondDate = DateAdd("yyyy", 2, Me.FirstDate)
      End If
    End Sub
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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