Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    Alabama
    Posts
    37

    Unanswered: Is there a way perform CTRL+' with vba code in MsAccess 2000

    Is there a way perform CTRL+' with vba code in MsAccess 2000

    Carbo

    CTRL+' copies data from a field in the previous record to that field in the current record.

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    Carbo

    What are you actually trying to do?

  3. #3
    Join Date
    Apr 2003
    Location
    Alabama, USA
    Posts
    154
    I could be wrong, but it sounds like you want to copy certain fields when adding a new record. If so, then I would recommend using code to add a new record a not allow the user to navigate to a new record.

    So for the purposes of this example, I have a form with two fields, strString and dblNumber. The form as a button to add a new record, cmdAdd.
    Code:
    Private Sub cmdAdd_Click()
        On Error GoTo Err_cmdAdd_Click
    
        Dim strDefault As String, dblDefault As Double
        'Set "default" values for new record
        'to currect record values
        strDefault = Me.strString
        dblDefault = Me.dblNumber
    
        'Add new record
        DoCmd.GoToRecord , , acNewRec
        
        'Set "default" values for new record
        Me.strString = strDefault
        Me.dblNumber = dblDefault
    
    Exit_cmdAdd_Click:
        Exit Sub
    
    Err_cmdAdd_Click:
        MsgBox Err.Description
        Resume Exit_cmdAdd_Click
    
    End Sub
    http://AccessDB.Info

    You live and learn. At any rate, you live. - Douglas Adams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •