I have a form that contains  fields named Crition1, Criterion 2 .. up to .....Criterion 6   (And also Max1 to Max 6
The form is being used in continuous form mode.
In the records Before_Update event, I want to ensure that IF the user has typed text in the Criterion field, then there must be a Max value in the corresponding Max box.
I'm using MS Access - Office 365 Version 2112 (Build 14729.20260 Click to run)
Looking at a few posts, the following code should work. But I am getting a "242 runtime 'object required' " error.
	
	
	
		
Any thought welcome.
 The form is being used in continuous form mode.
In the records Before_Update event, I want to ensure that IF the user has typed text in the Criterion field, then there must be a Max value in the corresponding Max box.
I'm using MS Access - Office 365 Version 2112 (Build 14729.20260 Click to run)
Looking at a few posts, the following code should work. But I am getting a "242 runtime 'object required' " error.
		Code:
	
	
	Dim MyStr as String
Dim CritFld as String
DimMaxFld as String
MyStr = ""
For i = 1 To 6
    CritFld = "Criterion" & i
    MaxFld = "Max" & i
    Debug.Print "Fields : " & CritFld & ", " & MaxFld
    If Me.Controls(CritFld) Is Not Null And Me.Controls(MaxFld) Is Null Then      'Error is here
        If Me.Controls(MaxFld) Is Null Then                                                             'Error also occurs here
            MyStr = "Max" & i & vbCr
        End If
    End If
Next
if MyStr <>"" then "Display a message to the user"    'and cancel the update
	Any thought welcome.