DOCUMENT:Q190369 07-AUG-1998 [vbwin] TITLE :BUG: RDO LastModified Is Not Consistent After Moving EOF PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0, 6.0 OPER/SYS:WINDOWS KEYWORDS:kbVBp600bug kbVBp500bug kbcode ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 --------------------------------------------------------------------- SYMPTOMS ======== When you open an RDO resultset in Visual Basic, if the resultset is positioned at the EOF before issuing an AddNew and Update, the LastModified is the bookmark of the first item in the resultset instead of the newly added item. If the resultset is not positioned at the EOF before the Addnew and Update, the LastModified property correctly points to the newly added record. RESOLUTION ========== You can avoid this problem by not positioning the resultset at the EOF before issuing the Addnew and Update methods. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Start a new Visual Basic 6.0 Standard EXE project. 2. From the Project menu, click References. Select Microsoft Remote Data Object 2.0 and click OK. 3. Add a CommandButton to the default form and paste the following code into the CommandButton Click event. NOTE: You may need to alter the connection information to allow you to connect to your database. Sample Code ----------- Private Sub Command1_Click() Dim Conn As New rdoConnection Dim CSt As String Dim rs As rdoResultset Dim sSQL As String Dim i As Long With Conn .CursorDriver = rdUseServer .Connect = "DRIVER={sql server};SERVER=yourserverhere;" & _ "DATABASE=pubs;UID=sa;PWD=" .EstablishConnection End With sSQL = "SELECT * FROM titles where pub_id = '0877'" Set rs = Conn.OpenResultset(Name:=sSQL, Type:=rdOpenKeyset, _ LockType:=rdConcurRowVer, Options:=rdExecDirect) Conn.BeginTrans ' If the resultset was at EOF before the AddNew and Update, ' LastModified will be the bookmark of the first item in ' the resultset. For instance, the following pubdates will ' be the same. If the resultset is not at EOF, the first ' pubdate will be the date of the newly added row. rs.MoveLast '<