Selasa, 23 September 2014

Re: [MS_AccessPros] Error 2015 You can ’t go to the specified record

 

Phucon-


Using a separate Recordset should do noting in your form.  Your code opens tblContracts, and if there is at least one record, then you do a MoveNext on that recordset.  The record displayed on your form should not change.

You have to MoveNext in the form's Recordset (found in the Recordset property of the form or Me.Recordset) to get the display to change.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Sep 23, 2014, at 11:07 PM, saigonf7q5@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Hello Mr.Viescas

 

Thank you very much.

 

The "RunCommand acCmdSelectRecord   DoCmd.SetWarnings False  RunCommand acCmdDeleteRecord  DoCmd.SetWarnings True" works very good.

 

However I tried replacing the RecordsetClone with the OpenRecordset method (see the below procedure). It seems to be working ok so far, but is it a good practice to do it in this way?

 

Thank again

Phucon.

 

Private Sub cmdNext_Click()
On Error GoTo ErrorHandler

Set db = CurrentDb
Set rs = db.OpenRecordset("tblContracts", dbOpenDynaset)

If Not (rs.EOF And rs.BOF) Then
    MoveNext
Else
    MovePrevious
End If

rs.Close

ExitProcedure:
  Exit Sub

ErrorHandler:
   MsgBox Err.Number & vbCrLf & Err.Description
   Resume ExitProcedure
   Resume
End Sub


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

.

__,_._,___

Tidak ada komentar:

Posting Komentar