Cross form search

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kaosu
    New Member
    • Oct 2007
    • 19

    Cross form search

    I would like to know how to do a search in a text box on Form X that closes Form X and opens Form Y and looks for the information in Y.

    The search works perfectly when preformed while on Form Y. The search box is identical on both X and Y, its just getting X to point at Y when executing this command.

    Code:
        Dim strFilter As String
        strFilter = ""
        If IsNull(Me!fnSRH) Then
            strFilter = strFilter
        Else
            If strFilter = "" Then
                strFilter = strFilter & "FullName Like '*" & Me!fnSRH & "*'"
            Else
                strFilter = strFilter & " AND FullName Like '*" & Me!fnSRH & "*'"
            
        End If
        End If
        
        Me.Filter = strFilter
        Me.FilterOn = True
        Me!fnSRH = Null
  • Lysander
    Recognized Expert Contributor
    • Apr 2007
    • 344

    #2
    Not 100% certain what you are trying to do, but this may help.

    At the end of your code you say me.filter=strFi lter. I assume you want this on Form X.

    so try this.

    [code=vba]
    DoCmd.OpenForm "formy", , , , , , strFilter

    [/code]

    and then in FormY OnOpen event
    [code=vba]
    DoCmd.Close acForm, "FormX"
    me.filter=opena rgs

    [/code]

    Comment

    Working...