Results 1 to 7 of 7

Thread: Subforms: this should be easy [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Subforms: this should be easy [RESOLVED]

    I'm working with VBA/Access 2000.

    I have a frmForm and a frmSubform. The subform is independant, no child link and all. It shows a customer's info (name, adress and so on).

    I want the subform to go to a newrecord. I've tried the following "GoToRecord" method, with no succes:

    DoCmd.GoToRecord acDataForm, Forms!frmForm.frmSubform.Form.Name, acNewRec

    I get the error: "The Object 'frmCustomer' isn't open".

    ...so it gets the form name alright, but because it's in a subform (?), it says it isn't opened.

    Any idea? Thanks
    Last edited by Krass; Jan 14th, 2004 at 08:12 PM.
    Chris

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Well, is the form open? Have you loaded it?

  3. #3

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    Yes it is opened.

    The customer's file is all there in the subform... I can even interact with it. I don't know how to reach a "new record".

    Keeps on saying the form isn't opened. It is actually opened, but throught the subform - it's the only (and important, it seems) difference.
    Chris

  4. #4

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Problem solved.

    I solved my problem. VB Help comes in handy sometimes:

    If you leave the objecttype and objectname arguments blank (the default constant, acActiveDataObject, is assumed for objecttype), the active object is assumed.

    So I replaced:
    DoCmd.GoToRecord acDataForm, Forms!frmForm.frmSubform.Form.Name, acNewRec

    by:
    DoCmd.GoToRecord , , acNewRec

    Works good.
    Chris

  5. #5
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    Have you ever have code just stop working while dealing with sub forms? I just can't get to the bottom of it.
    ?
    'What's this bit for anyway?
    For Jono

  6. #6

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    I'm not using subforms the way it's meant to be used. I simply added a subform control to an old application so I could use a listbar on the left of the main window.

    That way, clicking the listbar just selects the form to be displayed in the subform.

    I'm playing with 2 subforms, making the navigation real quick from one screen (subform) to another only by playing with the "visible" property.

    No problem so far.
    Chris

  7. #7
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    I do that too, I have all the navigation on a sub form... it's the bound one's that are Ping about on me... thanks tho'
    ?
    'What's this bit for anyway?
    For Jono

Posting Permissions

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



Click Here to Expand Forum to Full Width