INFO: AbsolutePosition Property with JET Databases in ADO

ID: Q194607


The information in this article applies to:


SUMMARY

The AbsolutePosition Property in ADO returns a -1 if the Cursorlocation property is set to adUseServer, the ADO default. This is essentially saying that the AbsolutePosition is unknown, adPositionUnknown.


MORE INFORMATION

Setting the CursorLocation property of the ADO recordset object to adUseClient corrects this problem.

Steps to Reproduce Behavior

  1. Create a Standard EXE project in Visual Basic. Form1 is created by default.


  2. Add a reference to the Microsoft ActiveX Data Objects Library.


  3. Add a command button to the form and place the following code in the Click event of the button:

    
    
       Dim cn As New ADODB.Connection
       Dim rs As New ADODB.Recordset
    
       cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security " & _
       "Info=False;Data Source=C:\Program Files\Microsoft Visual " & _
       "Studio\VB98\Nwind.mdb"
    
       ' Uncomment the below line to change AbsolutePosition value
       'rs.CursorLocation = adUseClient
       rs.Open "select * from employees", cn, adOpenKeyset
    
          Debug.Print "There are " & rs.RecordCount & " records in employees"
    
       Debug.Print "AbsolutePosition is " & rs.AbsolutePosition
     


  4. Run the code to test the project. Note that the AbsolutePosition property returns -1 (False) when the CursorLocation is set to server.



REFERENCES

For more information about ActiveX Data Objects (ADO) visit the Universal Data Access Web site at the following address:

http://www.microsoft.com/data/

Additional query words: kbADO200 kbVBp600 kbMDAC200 kbdse


Keywords          : kbADO200 
Version           : WINDOWS:1.5,2.0
Platform          : WINDOWS 
Issue type        : kbinfo 

Last Reviewed: March 12, 1999