Results 1 to 12 of 12
  1. #1
    Join Date
    Jun 2008
    Posts
    13

    Unanswered: Howto move to the * new record in a form

    Hello,

    I am using MoveLast to move to the last record on a form.
    However, I would prefer moving to the "New" record instead.
    This would help users most of the time.

    How can I do that in VBA ?

  2. #2
    Join Date
    Jun 2008
    Posts
    163
    I usually use the wizard for it. The add new record function will usually send the cursor into the first editable part of an entry form.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Have a look at the options on this function
    Code:
    DoCmd.GoToRecord
    George
    Home | Blog

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    VBA!

    DoCmd.GoToRecord , , acNewRec
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Sorry George, I handed him a fish ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Kid's gotta eat sometime, eh
    George
    Home | Blog

  7. #7
    Join Date
    Jun 2008
    Posts
    13
    Hi guys, I was using this:

    myForm.recordset.moveLast

    when I realized I would prefer to moveNew.

    It never came to my mind to look at this odd DoCmd object.
    Thanks!

    Postscriptum:
    To be more precise my move statement was this:

    Me.Parent.otherSubform.Form.Recordset.MoveLast

    Can this be translated with DoCmd?
    Last edited by lalbatros; 07-07-08 at 08:26.

  8. #8
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    How about

    DoCmd.GoToRecord acDataForm, "otherSubform", acLast
    or
    DoCmd.GoToRecord acDataForm, "otherSubform", acNewRec

    ???

    Access Help (GoToRecord) may help


    MTB

  9. #9
    Join Date
    Jun 2008
    Posts
    13
    Mike,

    I tried these two things:

    DoCmd.GoToRecord acDataForm, "otherSubform", acLast
    DoCmd.GoToRecord acDataForm, "parentForm!otherSubform", acLast

    This creates an error:

    "The object 'xxx' isn't open."

    It indicates that -apparently- DoCmd cannot reach the intended form.

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Hmm... I don't know offhand how you could use VBA to goto the new record on another subform from a subform.... but yes, it's beyond the scope of DoCmd.GotoRecord.

    I'll have to have a play around on this one...
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  11. #11
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Quote Originally Posted by lalbatros
    Mike,

    I tried these two things:

    DoCmd.GoToRecord acDataForm, "otherSubform", acLast
    DoCmd.GoToRecord acDataForm, "parentForm!otherSubform", acLast

    This creates an error:

    "The object 'xxx' isn't open."

    It indicates that -apparently- DoCmd cannot reach the intended form.
    Ok so that doesn't work.

    How about this

    Form_otherSubform.Recordset.AddNew

    ??

    I assume 'otherSubform' is the actual name of the sub form!

    MTB

  12. #12
    Join Date
    Jun 2008
    Posts
    163
    Just a suggestion...

    Why not have command to open the target form, and it would have an on open event script that contains "DoCmd.GoToRecord , , acNewRec"?

    I might have misunderstood you though.

Posting Permissions

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