T
Ted
not all that certain which forum would be most relevant for this posting, but
i'll just post it here and see what happens to bring it closer to getting a
resolution.
as the heading suggest, this is to do in whole/part to the said error
associated with the following code (i as a relative newbie am tackling):
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.SetFocus
Me.Future_Visit.Value = DLookup("FollowUp", "Query5")
Me.On_Study_Date.SetFocus
' Me.Future_Visit.Value = "01/01/1900"
End If
End If
End Sub
the SQL in Query5 looks like this:
SELECT S.[Last Name], S.[First Name], S.[IRB#], S.[Study #], S.[Seq#],
S.Months, [Forms]![Screening Log]![On-Study Date] AS [On-Study Date],
S.Schedule, S.[F/U Status], S.FollowUp
FROM [Sort By Month_X] AS S INNER JOIN Query3 AS Q ON (S.[Last Name]=Q.[Last
Name]) AND (S.FollowUp=Q.NextVisit)
WHERE (((S.[Last Name])=[Forms]![Screening Log]![Last Name]));
in words, i have created a miniature of my production database with a few
salient controls to test out an improvement. the new functionality will
generate a 'follow-up' visit date once the 'onstudy date' is entered anew or
modified by the user;
there is some vba i place in the form's currentevent condition to handle the
case where the user scrolls through the mdb and the follow-up date needs
refreshing using the following:
Private Sub Form_Current()
Dim Future_Visit As Date
If Not IsNull(Me.IRB_) Then Me.Future_Visit.Value = DLookup("FollowUp",
"Query4")
End Sub
where query4 is
SELECT S.[Last Name], S.[First Name], S.[IRB#], S.[Study #], S.[Seq#],
S.Months, S.[On-Study Date], S.Schedule, S.[F/U Status], S.FollowUp
FROM [Sort By Month] AS S INNER JOIN Query3 AS Q ON (S.[Last Name]=Q.[Last
Name]) AND (S.FollowUp=Q.NextVisit)
WHERE (((S.[Last Name])=[Forms]![Screening Log]![Last Name]));
which works just fine.
i next decided to tackle the case where the user modifies the onstudy date
and sees that the previous date in followup has gone blank by placing the vba
in the beforeupdate event and modifying query4 so that it would use the newly
typed value of onstudydate and that's where things began to get a bit
'escherian'.
for some reason i got the impression that i needed to use the setfocus
command in order to get the newly entered value of the onstudy date into the
Query5 code so that it could use it to compute the newer value and autofill
the followup control. that seems to have triggered this 2108 error message of
a2k's.
i know that i can workaround all this by using a conditional format which
turns the field with the followup date red when the onstudy date's modified
(once the user moved away from the record and returned to it again the saved
record would display the correct folloup date) but i like the idea of the new
date's appearing as the user is working on the active record. is there a way
out of this recursive occlusion?
i'll just post it here and see what happens to bring it closer to getting a
resolution.
as the heading suggest, this is to do in whole/part to the said error
associated with the following code (i as a relative newbie am tackling):
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.SetFocus
Me.Future_Visit.Value = DLookup("FollowUp", "Query5")
Me.On_Study_Date.SetFocus
' Me.Future_Visit.Value = "01/01/1900"
End If
End If
End Sub
the SQL in Query5 looks like this:
SELECT S.[Last Name], S.[First Name], S.[IRB#], S.[Study #], S.[Seq#],
S.Months, [Forms]![Screening Log]![On-Study Date] AS [On-Study Date],
S.Schedule, S.[F/U Status], S.FollowUp
FROM [Sort By Month_X] AS S INNER JOIN Query3 AS Q ON (S.[Last Name]=Q.[Last
Name]) AND (S.FollowUp=Q.NextVisit)
WHERE (((S.[Last Name])=[Forms]![Screening Log]![Last Name]));
in words, i have created a miniature of my production database with a few
salient controls to test out an improvement. the new functionality will
generate a 'follow-up' visit date once the 'onstudy date' is entered anew or
modified by the user;
there is some vba i place in the form's currentevent condition to handle the
case where the user scrolls through the mdb and the follow-up date needs
refreshing using the following:
Private Sub Form_Current()
Dim Future_Visit As Date
If Not IsNull(Me.IRB_) Then Me.Future_Visit.Value = DLookup("FollowUp",
"Query4")
End Sub
where query4 is
SELECT S.[Last Name], S.[First Name], S.[IRB#], S.[Study #], S.[Seq#],
S.Months, S.[On-Study Date], S.Schedule, S.[F/U Status], S.FollowUp
FROM [Sort By Month] AS S INNER JOIN Query3 AS Q ON (S.[Last Name]=Q.[Last
Name]) AND (S.FollowUp=Q.NextVisit)
WHERE (((S.[Last Name])=[Forms]![Screening Log]![Last Name]));
which works just fine.
i next decided to tackle the case where the user modifies the onstudy date
and sees that the previous date in followup has gone blank by placing the vba
in the beforeupdate event and modifying query4 so that it would use the newly
typed value of onstudydate and that's where things began to get a bit
'escherian'.
for some reason i got the impression that i needed to use the setfocus
command in order to get the newly entered value of the onstudy date into the
Query5 code so that it could use it to compute the newer value and autofill
the followup control. that seems to have triggered this 2108 error message of
a2k's.
i know that i can workaround all this by using a conditional format which
turns the field with the followup date red when the onstudy date's modified
(once the user moved away from the record and returned to it again the saved
record would display the correct folloup date) but i like the idea of the new
date's appearing as the user is working on the active record. is there a way
out of this recursive occlusion?