how to change control based on changes in another one on same form

T

Ted

i have a form that is intended to record some biographical data along with a
visit date ("OnStudy") and which would display in another control the date of
a future visit.

i placed the following in my OnCurrent event so that each time the user goes
to another record it computes the current record's future visit data:

Private Sub Form_Current()
Dim Future_Visit As Date
If Not IsNull(Me.IRB_) Then Me.Future_Visit.Value = DLookup("FollowUp",
"Query4")
End Sub

and it works.

it occurs to me that the future date might be changed if the user were to
change the on study date at some point and that we might want to cover that
contingency, so i wrote the following which i place in the on study date's
before update event thinking that it would 'automatically' sense a change had
taken place in it and actuate the DLookUp function that resolved the future
visit's value

Private Sub On_Study_Date_BeforeUpdate(Cancel As Integer)
Dim Future_Visit As Date
If Me.Dirty Then
If Not IsNull(Me.IRB_) Then
Me.Future_Visit.Value = DLookup("FollowUp", "Query4")
End If
End If
End Sub

since it did NOT succeed in doing this, i began to wonder what all else i
need to do to get my a2k application to grasp what i'm trying to do.

any thoughts would be (to this newbie) appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top