Results 1 to 5 of 5
  1. #1
    Join Date
    May 2010

    Unanswered: Subform Question

    Hi All,

    From what I have read, subforms are ONLY for one-to-many relationships (i.e. parent/child), not for listing all the records of a table that meet the user's selection criteria.

    Can I use the subform object that VBA supplies, to list records based on the user's selection criteria?

    What I am trying to do is allow the user to view a list (similar to that of a subform) of all the records of the table that meet the user's selection criteria.

    Can I do this with a subform object or will I have to create a form to do this?

    I hope this does not sound too confusing -

    Thank you in advance for your help!!!


  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    Though subform data is usually related to the main form data, it is not a requirement. You should be able to do what you describe.

  3. #3
    Join Date
    Apr 2004
    outside the rim
    if you are using the "main form" to set selection criteria and the "sub form" to review the results, it almost sounds like the "main form" content can be in the "header" and the the "sub form" be in the "detail" and don't use the sub form control at all - put it all on one form.

    Instead, use the code to set the form's "filter" property.

    An approach to get a sf to display specific records independent of the main form is to use code to revise the query that feeds the sf (and just requery the sf as needed).
    have fun!

    Todd S.
    click to email

    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET

    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

  4. #4
    Join Date
    Feb 2004
    Chicago, IL
    Yes, I have used this approach several times in the past. Personally, I would recommend the subform approach. If you are searching a large table then the unbound main form will open very quickly instead of trying to access the records in the table that the user probably doesn't want to see anyway.

    Also, with a subform control you can Enable the form and or Lock the form until the user has selected the peoper criteria to perform a search. Then you can do the search and Enable the subform for the user to select a record to view details. It allows you to give the user a visual cue that the data has been searched for. There are other approaches that will work, but I prefer this one.

  5. #5
    Join Date
    May 2010
    Thanks tcace and DCKunkle for your help.

    With all the assistance from you both and others, I was able to achieve what I was looking to do using a continuous bound subform, and an unbound main form. I also found an excellent example that someone had posted to assist another with the same issue as I had.

    Still learning Access/VBA, and beginning appreciate its strength! I am still a mainframer at heart though.

Posting Permissions

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