Full Version: slightly desperate - can't find control
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
redux8
The code below works perfectly in Access 97 but when I run it in Access 2002 I get a run time error telling me Access can't find the control when I'm trying to assign the variable v3 [v3 = Me("ListQID" & i).Value] and v4 [v4 = Me("Combo" & i).Value]. I've posted in Access Modules not getting a lot of view there. Any help would be greatly appreciated. Oh, I've already checked the library reference which I though was problem but that did not do the trick shrug.gif

Thanks
Gregg

Private Sub Command534_Click()
Dim v1 As String 'RID
Dim v3 As String 'QuestionID
Dim v4 As String 'Response

Dim i As Integer 'Counter
Dim j As Integer 'Counter


Application.SetOption "Confirm Action Queries", False

On Error GoTo ErrorHandler

If IsNull(Me.RID) = True Then RID.SetFocus: Exit Sub


v1 = [RID]

For i = 2 To 75


v3 = Me("ListQID" & i).Value
v4 = Me("Combo" & i).Value


If i < 9 Then

DoCmd.RunSQL ("Insert into tbl_intrv_info (RID,qid,response)" & _
"Select '" & v1 & "', '" & v3 & "', '" & v4 & "';")

Else: DoCmd.RunSQL ("Insert into tbl_responses (RID,qid,response)" & _
"Select '" & v1 & "', '" & v3 & "', '" & v4 & "';")

End If

Me("Combo" & i).Value = Null

10:
Next i


For j = 63 To 65 Step 1
If Me("Check" & j).Value = True Then
v3 = "Dissem06"
v4 = Me("Check" & j).Tag
DoCmd.RunSQL ("Insert into tbl_responses (rid,qid,response)" & _
"Select '" & v1 & "', '" & v3 & "', '" & v4 & "';")

Me("Check" & j).Value = False
End If
Next j

[RID] = Null

Application.SetOption "Confirm Action Queries", True
RID.SetFocus
DoCmd.RunCommand acCmdDataEntry
Exit Sub

ErrorHandler:
Resume 10:
End Sub
MStef
Hello redux8!
Try this v3 = Me.ListQID & i
v4 = Me.Combo & i
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.