Results 1 to 4 of 4
  1. #1
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183

    link to a subform field from the main form

    Seems like nothing I have so many questions today.
    I have a main form and a sub form. The main form have a command button where when I clicked, the Sub form text fields should be empty or cleared.



    How do I refer to that of subform from the main form?

    This is what I have now and its not working.
    Code:
    Me.Forms![frmAuditAddNewMain]![frmAuditAM].Form!Text123 = ""
    Thanks

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    me!subformname!textboxname=""

    The subform is just another control on your main form and can be referred to as any other.

  3. #3
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    Quote Originally Posted by aytee111 View Post
    me!subformname!textboxname=""

    The subform is just another control on your main form and can be referred to as any other.

    Thanks aytee! It works but now I actually realized thats not what I thought it would give me.

    I actually is looking for a ADD NEW button/command in the main form for the subform.

    so which means all my information in the main form will stay the same except the subform when I click add new button from the main form.

    How do I do that?

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You know, I actually have no idea how to do that! I have been playing around with a few different methods but I couldn't get any of them to work. The only way I succeeded is to put the Add New button on the header of the subform with the following OnClick code:
    DoCmd.GoToRecord,,acNewRec

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

Similar Threads

  1. Link main form with subform
    By lizzywu in forum Forms
    Replies: 1
    Last Post: 11-18-2011, 03:22 PM
  2. Replies: 3
    Last Post: 11-16-2011, 01:56 PM
  3. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  4. Replies: 1
    Last Post: 11-13-2010, 12:57 PM
  5. Replies: 3
    Last Post: 11-05-2010, 03:10 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