Re: previous record from new record

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Marshall Barton (marshbarton_at_wowway.com)
Date: 05/09/04


Date: Sun, 09 May 2004 13:02:03 -0500

max wrote:

>Hi all,
>I really do not have a clue why I get an error in the following situation.
>
>I have this code associated to a cmd button on a form, to move to the
>previous record:
>------------------ start of code --------------------------
>Private Sub cmdUndoNew_Click()
>On Error GoTo Err_cmdUndoNew_Click
>
> DoCmd.RunCommand acCmdRecordsGoToPrevious
> medNum.SetFocus
>
>Exit_cmdUndoNew_Click:
> Exit Sub
>
>Err_cmdUndoNew_Click:
> MsgBox Err.Description
> Resume Exit_cmdUndoNew_Click
>
>End Sub
>------------------ end of code -------------------------
>this button appears when the recordset moves to a new record. Normally
>pressing this button, provided that nothing has been written in the new
>record (otherwise the button automatically disappear), the recordset moves
>to the previuos record, the last of the recordset, canceling the new record
>that was going to be filled in.
>This button works perfectly using the form normally, while it gives the
>error "the command or action CmdRecordsGoToPrevious isn't available now".
>Does anybody have an idea why this is happening?

The only thing that comes to mind is that there is no
previous record.

-- 
Marsh
MVP [MS Access]


Relevant Pages

  • previous record from new record
    ... I really do not have a clue why I get an error in the following situation. ... I have this code associated to a cmd button on a form, ... Private Sub cmdUndoNew_Click ... to the previuos record, the last of the recordset, canceling the new record ...
    (microsoft.public.access.formscoding)
  • Re: Why Cant I Delete a record this way?
    ... DataAdapter and configure the CommandText of the various sub command objects ... > Dim dsChanged As New Data.DataSet ... > Dim cmdStr As String ... > Dim Cmd As New OleDb.OleDbCommand ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem with ADO in VB6
    ... If cmbName1.ListIndex < 0 Then Exit Sub ... Dim cmd As ADODB.Command ... Set cnn = New ADODB.Connection ... Set rst = New ADODB.Recordset ...
    (comp.lang.basic.visual.misc)
  • Re: Table in a form
    ... I would like to create a cmd button the will that will show the details of ... query. ... > specific query as its record set. ... > Private Sub cmdW2K_MouseDown(Button As Integer, Shift As Integer, X As ...
    (microsoft.public.access.forms)
  • Re: MS Access 2002: Go to newly added record from form2 to form 1
    ... for the onclick event of a cmd button. ... 'Dim rs As DAO.Recordset ... You don't say what the error is, but if a sub may generate an error then you ... Dim lngQID As Long ...
    (comp.databases.ms-access)