Results 1 to 6 of 6
  1. #1
    new2access123 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6

    How to populate a subform using a record set

    I have created a normalized database Client, Project, Participant, TestName and Scores. TestName is a look up table containing the test names, Scores has a FK to the Participant and TestName.



    I have enabled referential integrity in the relationships. Client may have many Projects and a project may have many Participants. A participant may have many tests and scores.

    I have created a record set (dbOpenDynaset) that brings together the client, project, test name and scores for a selected participant. I will need to edit existing data and append and delete rows.

    My question is how can I populate a subform from the record set so I can add edit and delete? Can some one provide some sample code or direct me to a sample?

    Thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link is what you are looking for: http://allenbrowne.com/ser-61.html

  3. #3
    new2access123 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    Thank you. That was very helpful information.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Were you able to create an updateable query for your SubForm Recordset?

  5. #5
    new2access123 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    6
    Quote Originally Posted by RuralGuy View Post
    Were you able to create an updateable query for your SubForm Recordset?
    I have gotten the subform working and is refreshing the data view properly. After more study I got an understanding of the relationship of the Main form to the sub form. I did not need to use a record set at all.

    This has lead me to a couple of questions though. Keep in mind this is a training exercise for me. so there is no context to the task i want to perform in these questions. But i know i will need to perform these tasks in my actual application.
    1. I would like to programmatically change/populate a value in the data view. Let's say that i add a row to the view and close the form. If field "MustHave" is not populated how can i populate the field programmatically?

    2. this is probably related to the first question. I want to use the ColumnHidden property so the user can not access some columns in the data view. I am at a loss to figure out how to correctly address the sub form?
    i tryed this but i get an error that the sub form can't be found

    Private Sub Form_Open(Cancel As Integer)
    Me.ParticipantID.ColumnHidden = True
    End Sub
    Attachment 728
    This is a screen shot of my modules. The name in the module list is different that the name i gave the subform "Participant subform" which i see in my forms list.

    What is the correct path to the subform so i can use ColumnHidden and in what event would i place the code?

    I can give you the detail as to why I will need to do these tasks but i did not want to get side tracked.

    Thanks

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this link helps some: http://www.mvps.org/access/forms/frm0031.htm

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

Similar Threads

  1. new record is subform
    By Seven in forum Forms
    Replies: 5
    Last Post: 01-10-2010, 08:24 PM
  2. Populate date from previous record
    By Lianes in forum Access
    Replies: 3
    Last Post: 09-19-2009, 03:42 PM
  3. Subform add new record
    By ricardo9211 in forum Forms
    Replies: 0
    Last Post: 08-26-2009, 12:01 AM
  4. Replies: 0
    Last Post: 06-23-2009, 03:01 PM
  5. Can I edit a record with a subform?
    By bigmax in forum Forms
    Replies: 0
    Last Post: 08-11-2008, 07:55 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