tatendatiffany
Board Regular
- Joined
- Mar 27, 2011
- Messages
- 103
i am getting the error message in part of my code on the line in bold. any ideas?? so i cab successfully login it but it just doesnt seem to be running the queries because of that one error i thought i had added everything you need.HELP
Code:
Sub getresults()
On Error GoTo errorhandler
Dim r As Integer
Dim c As Integer
Dim str As String
Dim SQL As String
Dim rtnVal As String
Dim WhichWorksheet As String
Dim NamedRange As String
Dim fldCount As String
Dim rs As Recordset
Dim cn As ADODB.Connection 'Your loop currently picks up the string from the cells and passes it to the Getrecordset function.
'It is in that function that you need to create the recordset
Call CheckConnection
Set MFrst = Nothing
If MFcnn.State = 1 Then ' check connection to database
For c = 31 To 35
For r = 2 To 39
If Cells(r, c).Value <> "" Then
str = Cells(r, c).Value
rtnVal = getrecordset(str)
Cells(r, c - 5).Value = rtnVal
End If
Next r
Next c
If MFcnn.State = adStateOpen Then MFcnn.Close
End If
Exit Sub
errorhandler:
If MsgBox("An error occurred while performing action" & vbCrLf & vbCrLf & Err.Description & vbCrLf & vbCrLf & "Do you want to continue?", vbCritical + vbOKCancel, Err.Source) = vbOK Then
[B] rtnVal = vbNullString
[/B] Resume Next
End If
If MFcnn.State = adStateOpen Then MFcnn.Close
End Sub