Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter on SubForm Doesn't Work Now?

Status
Not open for further replies.

Ciralia

Programmer
Oct 22, 2002
51
US
I have one main form called "frmSearchMain" that holds two subforms called "frmSearchNavigation" and "frmSearch". Before I put the subforms onto the main form I created a filter for the form called "frmSearch", and it works perfectly on that form. But when I put that form as a subform on "frmSearchMain" the filter no longer worked. The filter is done by a separate form called "frmFilter". Anyone know why the filter doesn't work when I just make it a subform?
 
we need to see your code.

What did one mind reader say to another?????








"You are fine, How am I?"




rollie@bwsys.net
 
Here is the coding for my filter, it filters various attributes of a person:

temp = "" 'reset value of global string variable

If Not IsNull(cmbGender.Value) And (cmbGender.Value) <> &quot;Any&quot; Then

If temp = &quot;&quot; Then
temp = &quot;Gender=&quot;&quot;&quot; + cmbGender.Value + &quot;&quot;&quot;&quot;

Else
temp = temp + &quot;and Gender=&quot;&quot;&quot; + cmbGender.Value + &quot;&quot;&quot;&quot;

End If
End If

If Not IsNull(cmbHairColor.Value) And (cmbHairColor.Value) <> &quot;Any&quot; Then

If temp = &quot;&quot; Then
temp = &quot;HairColor=&quot;&quot;&quot; + cmbHairColor.Value + &quot;&quot;&quot;&quot;

Else
temp = temp + &quot;and HairColor=&quot;&quot;&quot; + cmbHairColor.Value + &quot;&quot;&quot;&quot;

End If
End If

If Not IsNull(cmbHairType.Value) And (cmbHairType.Value) <> &quot;Any&quot; Then

If temp = &quot;&quot; Then
temp = &quot;HairType=&quot;&quot;&quot; + cmbHairType.Value + &quot;&quot;&quot;&quot;

Else
temp = temp + &quot;and HairType=&quot;&quot;&quot; + cmbHairType.Value + &quot;&quot;&quot;&quot;

End If
End If

If Not IsNull(cmbEyeColor.Value) And (cmbEyeColor.Value) <> &quot;Any&quot; Then

If temp = &quot;&quot; Then
temp = &quot;EyeColor=&quot;&quot;&quot; + cmbEyeColor.Value + &quot;&quot;&quot;&quot;

Else
temp = temp + &quot;and EyeColor=&quot;&quot;&quot; + cmbEyeColor.Value + &quot;&quot;&quot;&quot;

End If
End If

If Not IsNull(cmbEthnicity.Value) And (cmbEthnicity.Value) <> &quot;Any&quot; Then

If temp = &quot;&quot; Then
temp = &quot;Ethnicity=&quot;&quot;&quot; + cmbEthnicity.Value + &quot;&quot;&quot;&quot;

Else
temp = temp + &quot;and Ethnicity=&quot;&quot;&quot; + cmbEthnicity.Value + &quot;&quot;&quot;&quot;

End If
End If

DoCmd.Close
DoCmd.OpenForm &quot;frmSearchMain&quot;, acNormal, , temp 'open search form

All the filter button on my &quot;frmSearchMain&quot; form does is open the filter form again.


 
Ciralia,

check your temp with a

msgbox temp

It may be that closing the control with DoCmd.close

loses the temp as the scope of the control ends. If that is the case, try moving temp into a DIM variable and putting that in the criterion field.

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top