Results 1 to 4 of 4
  1. #1
    ms_bytes is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    2

    Linking subform to mainform; new entries and entry lookup

    Hi, so I have a MainForm and a Subform. The mainform has an autonumber assigned whenever you call it up, so that a new entry has an identifier. This is used for an RGA number (return goods). The mainform has some basic descriptors and then the Subform is used to enter the details; each item returned and its cause for return.

    The subform is using a Select query to pull up a table and I can fill in a line, then another and this populates that tables rows with my data. What I am missing is how to get the autonumber (RGA#) from the mainform to be added to every line I fill on the subform. This will later call up all items related to an RGA everytime I view the mainform.

    I have 1 form for entering a new RGA (mainform) and another form for edits to that RGA#. If I manually enter the RGA# then it works fine, but I cant get the form to enter the # for me. I copied a form that already did this entire process and I checked all the properties and cant find what I'm missing. I don't see any VB code performing this function on the other subform.



    Any help would be appreciated, thanks!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    You can have the field's default = the main form's RGA value.

    It sounds like the main form is using a primary key (RGA). You want to update any new records added to a related table via a subform. You need to include the RGA value in the Foreign Key of the table receiving UPDATE.

    In the subform, set the default value of the control bound to the Foreign key field to = the main form's control that is bound to
    RGA.

  3. #3
    ms_bytes is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    2
    thanks! this worked. I also had to create a separate subform for edits.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by ms_bytes View Post
    thanks! this worked. I also had to create a separate subform for edits.
    I am glad it did because when I read post #2 by itself I can not make heads nor tales....

    If you are interested, I posted a sample DB in the Data Base examples forum here. It addresses controlling a subform via a main form's controls. It offers an approach to change a subform from a form used to view data to a form that you can edit, to a form for data entry, and back. All of this without closing and opening new (different) forms.

    It is not overly intuitive because I did not post any comments within the code. My intent is to have people reverse engineer it so they understand it.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  2. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  3. Replies: 4
    Last Post: 03-30-2012, 01:47 AM
  4. Replies: 1
    Last Post: 11-29-2011, 01:37 AM
  5. MainForm/SubForm question
    By 10 Gauge in forum Forms
    Replies: 5
    Last Post: 03-04-2011, 07:46 AM

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