[AccessD] Recordset method Failed
David Emerson
newsgrps at dalyn.co.nz
Wed Sep 6 21:08:10 CDT 2017
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. Also
linked tables are coming through ok. It just seems to be setting
recordsets.
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.
We have tried restoring the SQL database with no luck. Any suggestions of
what I can try?
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
More information about the AccessD
mailing list