i am usin ado.With all typres of cursors it says rs.moveprevious says not allowed.

Set rs = conn.Execute("select * from customer", adOpenKeyset)

help me
Who is Participating?
mukunthConnect With a Mentor Commented:
The Execute method of the connection object returns a forward-only recordset.Use the above as:

rs.Open "select * from customer",adOpenKeySet

It will work as you want it to.
What are you connecting to? (e.g. SQL Server, Access)
What are the properties of your connection and recordset?
Use this is faster and you can movelast

Dim ArrayRs()
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
    Rs.Open "select * from customer, Conn, OpenForwardOnly, adLockReadOnly
Set Rs = Nothing

This will make a 2d array

to get the first row and first col:var=ArrayRs(0,0)
to get the second row and first col:var=ArrayRs(0,1)
to get the third row and first col:var=ArrayRs(0,2)

to get the first row and second col:var=ArrayRs(1,0)
to get the second row and second col:var=ArrayRs(1,1)

To get number of row return:var=Ubound(ArrayRs,2)

Whit .GetRows You can move forward and backward by change the index of ArrayRs(?,?)

You can do something like this

For i=0 to Ubound(ArrayRs,2)
     debug.print ArrayRs(0,i) 'this will print all result for the first field of the table

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Comment to my last comment:

When i write
to get the first row and first col:var=ArrayRs(0,0)

col is the field number of your select

ex.:select userid, username


row is the result row


if the result is

userid name
______ ____
1      John
5      Paul

Row #1 is UserId# 1
Row #1 is UserId# 5

Ryan ChongCommented:
Hi, check the EOF status.
The problem could be related to your database ( I've had problems using .update and .delete when connecting to an AS/400 database). But try the follwing 2 things and see if either works (second solution will be slower!)

' Initialise
Dim RecSet As ADODB.Recordset
Set RecSet As New ADODB.Recordset  

'Open for dynamic read only navigation
RecSet.Open "Select * from customer", conn, adOpenDynamic, adLockReadOnly, adCmdText

'Check recordset contains something
If RecSet.EOF Then
   MsgBox("No records exist", vbOkOnly + vbInformation)
   Set RecSet = Nothing

' If .MovePrevious doesn't work here then try the following

' initialise integers
Dim RecCount as Integer
Dim RecNum as Integer

' store number of records in set
RecNum = RecSet.RecordCount

'store current record in set
RecCount = 1

'Use procedure to simulate MovePrevious
Call MovePrevious(RecSet,RecCount,RecNum)

'write procedure to simulate MovePrevious
Public Function MovePrevious(RecSet as ADODB.RecordSet,
                             RecCount as Integer,
                             RecNum as Integer)
Dim i as Integer

Select Case RecCount
   Case 1
      RecCount = RecNum
      Exit Function
   Case 2
      RecCount = 1
      Exit Function
   Case Else
      For i = 1 to RecCount - 1
      Next i
      RecCount = RecCount - 1
      Exit Function  
End Select

End Function


you could use adOpendynamic instead of adOpenKeyset
You have 14 open questions today that need your attention.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder, Mindphaser or I will return to finalize these as soon as possible if after 7 days no response by the Asker.  EXPERTS-->  please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link 
------> POINTS FOR EXPERTS awaiting comments are listed in the links below (Part 1) (Part 2)
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange
Hi kar_online,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept mukunth's comment(s) as an answer.

kar_online, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with my recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer

E-E Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.