CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Sub Forms in Access

    Hello, I have a problem with Access that I hope someone can help with.

    I have a main form entitled "Main", which contains a sub form entitled "DataSheet", this is a datasheet representation of a table in the database. Within the main form, there is a combo box and when the user selects an item from here I need to update the sub form so that it queries the data on this value. Is there any easy way to do it?

    Thanks

    Andrew


  2. #2
    Join Date
    Nov 2000
    Location
    Chicago
    Posts
    51

    Re: Sub Forms in Access

    This can be done and is very common. It does involve a bit of vb code to make it work.

    Subform: The recordset used must reference the combobox of the main form (datasheet field = forms!main.combo1).

    Main form: The combo box "should" have a default value for the sub form to work off of, but not required. In the click event of the combo box, requery the subform (that's the vb code portion).

    Hope this helps.

    TB_Guy_2000

  3. #3
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: Sub Forms in Access

    Hello,

    Thanks very much for your help - I actually found a different way to do it, but similar to yours.

    In the event ComboBox_AfterUpdate I call a function within the subform which passes a parameter containing the data item I wish to filter on. As, in my main form I need to add and delete items this method can be done using several functions.

    Thanks for your help though, thought I would post a different solution incase anyone was interested!

    Andrew


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

Featured