[AccessD] Recordset method Failed
Jim Lawrence
accessd at shaw.ca
Thu Sep 7 21:55:16 CDT 2017
Did you check for any return errors or check to see if any records were returned?
Jim
----- Original Message -----
From: "David Emerson" <newsgrps at dalyn.co.nz>
To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com>
Sent: Wednesday, September 6, 2017 3:19:37 PM
Subject: [AccessD] Recordset method Failed
Hi Listers,
I have an accdb which uses ADO to get a recordset from an SQL Server
database
I am getting the following error:
Run-time error '-2147024770 (8007007e)'
Method 'Recordset' of object '_Combobox' failed.
The code is:
Set rstTemp = basRunDataObject("dbo.spfrmAAMenu", adCmdText) <--- This
function code is given at the end of this message
' If Not rstTemp.EOF Then
' rstTemp.MoveFirst
' Do Until rstTemp.EOF
' MsgBox rstTemp!LGARegionID
' rstTemp.MoveNext
' Loop
'End If
Set Me!cboFilterLGARegionIDNo.Recordset = rstTemp <--- Error on this
line
When I unrem the code block then the msgbox shows the values of the
LGARegionID which indicates that the recordset is being returned.
Here is the rub. The programme is working fine on my machine and on the
clients current machine. It is only on their new server that they are
wanting to migrate to that the problem happens.
Also, it is happening for all similar calls to set combobox recordsets and
form recordsets throughout the whole programme.
Also, it was working a few days ago, but when they tried yesterday it
stopped working.
The only area I can think of is some permissions at the SQL Server database
end. The IT department was playing with security settings. Could one of
these caused the problem?
Public Function basRunDataObject(strCommandText As String, commandType As
ADODB.CommandTypeEnum) As ADODB.Recordset
On Error GoTo Err_basRunDataObject
Dim adocmd As ADODB.Command
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.CursorLocation = adUseClient
If gADODBConnection.State = adStateClosed Then
Call basOpenGlobalConnection
End If
Set adocmd = New ADODB.Command
With adocmd
.ActiveConnection = gADODBConnection
.CommandText = strCommandText
.commandType = commandType
.CommandTimeout = 0
End With
rst.Open adocmd
Set basRunDataObject = rst
Set adocmd = Nothing
Exit_basRunDataObject:
Exit Function
Err_basRunDataObject:
Select Case Err
Case 0:
Case Else
Call basErrorMsg("basRunDataObject - " & strCommandText)
End Select
Resume Exit_basRunDataObject
Exit Function
End Function
Regards
David Emerson
Dalyn Software Ltd
Wellington, New Zealand
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list