Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Starting new record in subform with VBA (AccessXP)

    On a form with 2 subreports, so the form is tied to three different
    queries. I want to start a new record on the first subform. I tried the
    following, among other things, DoCmd.GoToRecord ,
    "subfrmCreditCardPaymentInvoice", acNewRec. I get an error messaging "it
    isn't open"

    I can't find it in any of my books.

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Starting new record in subform with VBA (AccessXP)

    Subforms aren't "open" in the sense that main forms are.

    If you are calling this code from the first subform itself, you don't need to refer to the object. Just use DoCmd.GoToRecord , , acNewRec.

    If you are calling this code from the main form, set focus to the subform first, before going to a new record:

    subfrmCreditCardPaymentInvoice.SetFocus
    DoCmd.GoToRecord , , acNewRec

    Note: you must use the name of the subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Starting new record in subform with VBA (AccessXP)

    Thanks Hans. I think I tried a version of the setfocus, but obviously I messed it up. Five seconds of work and the problem was solved.

    Fay

Posting Permissions

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