473,382 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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
1 1441
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Vitamin | last post by:
I have written a stored procedure which will paging the recordset, and return a range of record that i need, and i write a asp code to call it however, no any return after the set objRs =...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
2
by: ano1optimist | last post by:
I have a form with a search button. I'm using command parameters to pass search criteria to a stored procedure. Here is my code: Stored procedure: CREATE PROCEDURE . @strCriteria varchar(200)...
5
by: Timppa | last post by:
Hi, Could anyone help me with my problem ? Environment: Access 2000 and Sql Server 2000. I have a stored procedure as follows: DROP table1 SELECT alias1.field1,alias2.field2,table2.field6...
11
by: Colin Mardell | last post by:
Can anyone tell me what is wrong with the following? Whatever I do the report brings back all records in the table, rather than just those between the dates specified. Dim strDocName As String...
12
by: Scott | last post by:
Front-end Access 2000 I have a stored procedure that has 2 parameters BusinessUnitID and Year. It returns multiple record sets (5 to be exact). I thought I could use a Pass through query but...
1
damonreid
by: damonreid | last post by:
Access 2003 Microsoft Windows XP Pro Hey, I am currently pulling my hair out here. I have a Form for adding new projects to a database, the only problem is that when I close the form it doesn't...
6
by: binky | last post by:
Hi folks, I'm just learning how to use MS Access as a front end for SQL Server, and have a question: I have a stored procedure that returns a set of records from a SQL Server and loads it into a...
21
by: adjo | last post by:
I am working on an app with an Access2002 frontend and Sql2005 backend. I have to use integrated security. I want to prevent my users from altering data in another way than via the frontend. It...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.