Update a seperate field from an update of another field

  • Thread starter Thread starter David Sullivan
  • Start date Start date
D

David Sullivan

I have two fields called Contact Tag and Due date

The Contact Tag is a list field with 3 items in it,
Contact again in 6 months, Contact again in 1 month, no
contact again, dependent on which one I choose I want it
to update the next field Due date with a date for contact
in 6 month current date + 256 days; contact in 1 month
means due_date = current date + 30 days, and nocontact
again = leave due_date Null, can anyone suggest a
possible solution I am a access coding novice
 
David,

Here's one approach... In the After Update event of the Contact Tag
listbox, you can put code something like this...

Private Sub Contact_Tag_AfterUpdate()
Select Case Me.Contact_Tag
Case "Contact again in 6 months"
Me.Due_date = DateAdd("m",6,Date())
Case "Contact again in 1 month"
Me.Due_date = DateAdd("m",1,Date())
End Select
End Sub
 
Well, at first glance, I thought that you wouldn't need to explicitly
handle the third option, but I have reconsidered. Better to do this...

Private Sub Contact_Tag_AfterUpdate()
Select Case Me.Contact_Tag
Case "Contact again in 6 months"
Me.Due_date = DateAdd("m",6,Date())
Case "Contact again in 1 month"
Me.Due_date = DateAdd("m",1,Date())
Case "no contact again"
Me.Due_date = Null
End Select
End Sub
 
Back
Top