Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2010
    Posts
    12

    Unanswered: Open Form to New Record but Display all records?

    I have a form, ClientsFrm, and I have a button to open the form to view all the records. I would like to have a separate button open the form to a new record while still allowing the user to view all the records. Is this possible? I tried this code:

    Private Sub NewClientBtn_Click()

    On Error GoTo Err_NewClientBtn_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "ClientsFrm"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_NewClientBtn_Click:
    Exit Sub

    Err_NewClientBtn_Click:
    MsgBox Err.Description
    Resume Exit_NewClientBtn_Click


    End Sub

    But that doesn't open it to a new record. Thanks!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    Function OpenNewRec()
    
        DoCmd.OpenForm "Form1"
        DoCmd.GoToRecord acDataForm, "Form1", acNewRec
        
    End Function
    Have a nice day!

  3. #3
    Join Date
    Aug 2010
    Posts
    12
    that's great, thanks so much!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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