Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Posts
    2

    Unanswered: HELP please with passing filters between forms

    Hello,

    I'm reasonably new to ACCESS, but am quite familiar with VB6, Foxpro and a few other languages, however, I am having a serious problem, which is liable to result in the removal of large quantities of hair...

    I need to open a form (which has a number of embedded subforms) and filter to a selection made on a previous form.

    Unfortunately I have a One to Many relationship between the Main data for the form and one of the Subforms. I need to filter on data that appears in the Many part of the relationship (in one of the subforms). I cannot use the Distinct property of an SQL statement as The recordset it returns is not updateable.

    I am sure there is a very easy way around this and I would appreciate any help that can be offered

    Thanks

    Brendan

  2. #2
    Join Date
    Mar 2003
    Posts
    2

    Post Passing Filter

    You will need to have one or more common fields between forms: Ex: ID

    Set up a Subform (Child) that does not have any filters, the filter will be set from the Main Form (Master).

    On your Master Form place your Subform using the Subform Wizard.

    You can select the Common field for both forms. When you open the Master Form, your sub form will be filtered.

    If you click on the Subform, and look at the Data Tab, you should see ID as the Link Child Fields & Link Master Fields. If you want multiple fields for your filter, use a Semi Colon between fields.
    Ex: Link Child Fields: ID;LastName

    Hope this answers your question.

    Michael Pakay

  3. #3
    Join Date
    Mar 2003
    Posts
    1

    Thumbs up

    Private Sub Button_Click()

    Dim FormToOpen As String
    Dim FilterCriteria As String

    FormToOpen = "The_New_Form"
    FilterCriteria = "[The_ID_Field]=" & Me.The_ID_Field

    DoCmd.OpenForm FormToOpen, acNormal, , FilterCriteria, , ,

    End Sub
    Last edited by The_JFG; 03-03-03 at 16:57.

  4. #4
    Join Date
    Mar 2003
    Posts
    2
    Thanks very much for your answers. I don't think i explained myself too well as the answers given do not quite solve my problem. I will try again..

    I have two forms "Form A" and "Form B"

    I need to open "Form B" from information taken from"Form A". The Master Data on "Form A" does not have the link information, it is in a subform of "Form A" ("Form A" carries four subforms). There are reasons why the link data cannot appear on the master form (It has to do with the updateability of the form and for speed)

    Is this possible, could I create a Recordset that will only return the records I require without affecting the uniqueness of the underlying table.

    Once again thanks for the help so far.

    Brendan

Posting Permissions

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