Of course it won't compile without the proper control names in there. You didn't share that information in your question, so I had to put in something in their places to make it obvious what you needed to do.
Your code is thoroughly wrong though, as it doesn't allow for there being no date in the first control (we now know to be called [examCompDate]) or non-date data being entered into it and, although adding day values to dates can be done using integer arithmetic, that is not the recommended way for good reason. Also, your question asked for how to set the default value of the other control, which your code also doesn't manage properly.
Unless you now need something different from what you originally asked for, what you need is :
- Private Sub examCompDate_AfterUpdate(Cancel As Integer)
-
With Me
-
.examEffDate.DefaultValue = IIf(IsDate(.examCompDate), _
-
DateAdd("d", -7, CDate(.examCompDate)), _
-
Null)
-
End With
-
End Sub
... which is what I said in post #2 but which you didn't properly understand.