Updating field in subform set up in Datasheet View

Surdeymon

Registered User.
Local time
Today, 13:05
Joined
Jun 10, 2004
Messages
11
Hi - I searched hi and low to no avail - I have a subform that is in datasheet view - Whenever a user enters in a "visit date" I want the following code to calculate the value of Nbr - and store that value in a different subform control (Me.cboPostOpID.Value) - BUT the system cannot identify this control? The prob is at this line: Set Me.cboPostOpID.Value = Nbr

Does anyone have any thoughts on code that can do this for me?

This is in the AfterUpdate property -

Private Sub txtvisitdate_AfterUpdate()

Dim Nbr As Integer
Dim dd As Integer

dd = DateDiff("m", Me.txtvisitdate, [Forms]![frmBreastAssessmentDataForm]![DOS])

Select Case dd
Case Is <= 1
Nbr = 1
Case 2 To 3
Nbr = 2
Case 4 To 6
Nbr = 3
Case 7 To 9
Nbr = 4
Case 10 To 12
Nbr = 5
Case 13 To 24
Nbr = 6
Case 25 To 37
Nbr = 7
Case 38 To 49
Nbr = 8
Case 50 To 61
Nbr = 9
Case 62 To 73
Nbr = 10
Case 74 To 85
Nbr = 11
Case 86 To 97
Nbr = 12
Case 98 To 109
Nbr = 13
Case Is >= 110
Nbr = 14
End Select

Set Me.cboPostOpID.Value = Nbr
Me.Refresh

End Sub
 

Users who are viewing this thread

Back
Top Bottom