By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

Problem opening a recordset based on a stored procedure in Access Project

P: n/a
I am using the following code to open a recordset returned by a SQL
server stored procedure:

sConn = "Provider='SQLOLEDB';Data Source='Aph-Ework-Dev';" & _
"Initial Catalog='NB2KunsecuredSQL';Integrated
Security='SSPI';"

oConn.Open sConn

'Set up command to get list of required shifts
oCmdTmpShift.CommandText = "qslGetShiftsTMP"
oCmdTmpShift.CommandType = adCmdStoredProc
Set oCmdTmpShift.ActiveConnection = oConn
With oCmdTmpShift
.Parameters("@Ward") = Forms!frmBookNurse!strWard
.Parameters("@ShiftDate") = Me!dtmDateAvailable
.Parameters("@Shift") = Me!strShiftAvailable
.Parameters("@Enhanced") =
Forms![frmBookNurse]![ChkEnhanced]
.Parameters("@Grade") = Me!strGrade
'.Execute
Set oRSShift = New ADODB.Recordset
oRSShift.CursorType = adOpenStatic
oRSShift.LockType = adLockReadOnly
oRSShift.Open oCmdTmpShift
End With

THe problem is the cursor type is always forward only - not static as I
specified. This means that I can't get a recordcount or use
movefirst/movelast.
From what I have read this should be possible - What am I doing wrong?


Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I have the same type of code for a project im working on, only I just
set recordset = ocmdtmpshift.execute and dont set a cursortype of
locktype and it works fine

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.