Results 1 to 6 of 6
  1. #1
    Shadows1989 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    15

    Open form on new record

    Hi All,

    Me again, this is something really simple, I hope, for you experts.

    I have a homepage form that has a button on it called "Open Input Form", when the user presses this. The homepage form should close and the Input Form should open but on a new record, ready to add in new information. I also want the previous record to be viewable as I have a button that says previous record and another button that says next record.

    I have this VBA code here:

    Code:
    Private Sub button_Open_Input_Form_Click()
    DoCmd.GoToRecord acDataForm, "frm_Input_Form", acNewRec
    End Sub
    When I click on the button, I get a VB error that says:

    Code:
    Run-time error '2489' 
    
    The object 'frm_Input_Form' isn't open.
    What am I doing wrong? Surely it's something simple?



    Thanks for any help!

  2. #2
    Shadows1989 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    15
    Managed to solve this:

    Code:
    Private Sub button_Open_Publisher_Setup_Click()    
    DoCmd.OpenForm "frm_Publisher_Setup", acNormal, "", "", , acNormal
    DoCmd.GoToRecord , "", acNewRec
    End Sub
    So this can be solved too .

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you're only going to add records, there's an argument of OpenForm that will open the form in data entry mode. The advantage would be that it wouldn't pull all the records over the network.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Shadows1989 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    15
    Quote Originally Posted by pbaldy View Post
    If you're only going to add records, there's an argument of OpenForm that will open the form in data entry mode. The advantage would be that it wouldn't pull all the records over the network.
    Hi,

    I did try that initially but the aim is to add new while also being able to see the old, so I used the above code in my previous reply, which works a treat. Modified it a bit more so that it closes the initial form after opening the Input.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I must be blind and didn't see that you mentioned wanting previous records available. Sorry about that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Shadows1989 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    15
    Quote Originally Posted by pbaldy View Post
    I must be blind and didn't see that you mentioned wanting previous records available. Sorry about that.
    No problem at all bud .

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 12-17-2014, 03:31 PM
  2. Replies: 4
    Last Post: 12-16-2014, 05:08 PM
  3. Replies: 2
    Last Post: 03-13-2013, 06:13 PM
  4. Replies: 3
    Last Post: 08-26-2012, 10:04 PM
  5. Replies: 1
    Last Post: 05-03-2012, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums