T
Ted
I'm trying to suss out which way to do this in my A2K application.
When a user clicks the radio button linked to the 5, the objective is to
launch a query which uses two of the current form's control values as
criteria that determine which record from the current form's underlying table
gets appended to a linked table in the current database. As I understand the
OldValue property (courtesy of A2K help doc'n), "You can use the OldValue
property to determine the unedited value of a bound control".
What I have tried to do in the code I am attaching is lay out the various
actions I want to take place when, given the 'unedited value' of the bound
control, the user presses any one of the radio buttons in the Frame1.
This doesn't seem to getting quite off the ground as yet.
Are there any obvious Achilles' Heels in this so far you can make out?
-Ted
VBA Code:
Private Sub Frame1_AfterUpdate()
Select Case Frame1.Value
Case 1
Me.Onlistdate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 2
Me.REgisteredDAte.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 3
Me.OnStudyDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 4
Me.TXEndedDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 5
Me.OffStudyDate.SetFocus
If Me.Frame1.OldValue = 2 Or Me.Frame1.OldValue = 3 Or
Me.Frame1.OldValue = 4 _
Or Me.Frame1.OldValue = 6 Or Me.Frame1.OldValue = 7 Then
DoCmd.RunMacro ("Append Off Study Pxs--Edit Form")
Case 6
Me.LTFUDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 7
Me.DateDth.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case Else
End Select
End Sub
=====================================================
SQL version of Append Query:
INSERT INTO [Patients on Follow-Up] ( Dummy, [IRB Number], MR_Number, [Pt
Initials], [On-Study Date], Site, [Px Status] )
SELECT 1 AS Dummy, [Screening Log].[IRB Number], [Screening Log].MR_Number,
Left([First Name],1) & Left([Last Name],1) AS [Pt Initials], [Screening
Log].RegisteredDate AS [On-Study Date], [Screening Log].Campus AS Site,
lkpStatus.Status AS [Px Status]
FROM lkpStatus INNER JOIN [Screening Log] ON lkpStatus.Code = [Screening
Log].Outcome_
WHERE ((([Screening Log].[IRB Number])=[Forms]![Screening Log (Edit
Only)].[IRB Number]) AND (([Screening Log].MR_Number)=[Forms]![Screening Log
(Edit Only)].[MR Number]) AND (([Screening Log].Outcome_) In (5)));
When a user clicks the radio button linked to the 5, the objective is to
launch a query which uses two of the current form's control values as
criteria that determine which record from the current form's underlying table
gets appended to a linked table in the current database. As I understand the
OldValue property (courtesy of A2K help doc'n), "You can use the OldValue
property to determine the unedited value of a bound control".
What I have tried to do in the code I am attaching is lay out the various
actions I want to take place when, given the 'unedited value' of the bound
control, the user presses any one of the radio buttons in the Frame1.
This doesn't seem to getting quite off the ground as yet.
Are there any obvious Achilles' Heels in this so far you can make out?
-Ted
VBA Code:
Private Sub Frame1_AfterUpdate()
Select Case Frame1.Value
Case 1
Me.Onlistdate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 2
Me.REgisteredDAte.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 3
Me.OnStudyDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 4
Me.TXEndedDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 5
Me.OffStudyDate.SetFocus
If Me.Frame1.OldValue = 2 Or Me.Frame1.OldValue = 3 Or
Me.Frame1.OldValue = 4 _
Or Me.Frame1.OldValue = 6 Or Me.Frame1.OldValue = 7 Then
DoCmd.RunMacro ("Append Off Study Pxs--Edit Form")
Case 6
Me.LTFUDate.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case 7
Me.DateDth.SetFocus
If Me.Frame1.OldValue = 5 Then DoCmd.RunMacro ("Delete Off
Study Pxs--Edit Form")
Case Else
End Select
End Sub
=====================================================
SQL version of Append Query:
INSERT INTO [Patients on Follow-Up] ( Dummy, [IRB Number], MR_Number, [Pt
Initials], [On-Study Date], Site, [Px Status] )
SELECT 1 AS Dummy, [Screening Log].[IRB Number], [Screening Log].MR_Number,
Left([First Name],1) & Left([Last Name],1) AS [Pt Initials], [Screening
Log].RegisteredDate AS [On-Study Date], [Screening Log].Campus AS Site,
lkpStatus.Status AS [Px Status]
FROM lkpStatus INNER JOIN [Screening Log] ON lkpStatus.Code = [Screening
Log].Outcome_
WHERE ((([Screening Log].[IRB Number])=[Forms]![Screening Log (Edit
Only)].[IRB Number]) AND (([Screening Log].MR_Number)=[Forms]![Screening Log
(Edit Only)].[MR Number]) AND (([Screening Log].Outcome_) In (5)));