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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Code for my Form Filter doesn't Seem to Work? 1

Status
Not open for further replies.

HisEnergy

Programmer
Sep 25, 2006
5
US
Can someone help me on this code. When I click Submit it pulls all records into my Subform. It doesn't seem to see the value I select from my combox on my main form.

Thanks for you help!



Private Sub FindSearch_Click()
Dim strWhere As String

strWhere = "1=1"

' If ReferredBy
If Nz(Me.ReferredBy) <> "" Then
'Add the predicate
strWhere = strWhere & " AND " & "Contacts.[Referred By] = '" & Me.ReferredBy & "'"
End If


'DoCmd.OpenForm "Browse Contacts", acFormDS, , strWhere, acFormEdit, acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
Else
Me.Browse_All_Contacts.Form.Filter = strWhere
Me.Browse_All_Contacts.Form.FilterOn = True
End If
End Sub
 
How are ya HisEnergy . . .

In . . .
Code:
[blue]   strWhere = "1=1"[/blue]
. . . [purple]you do not reference a field![/purple]. [blue]Is not 1 always equal to itself![/blue] . . . [blue]now and forever![/blue] . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks AceMan1

Do you have any code that shows a a combo box with text values to pass to the form filter of the Subform.

I can get just plain Text Fields to pass values and query records. For some reason I must not be setting the combo box up correctly. I can't get any records returned when I use a combo box to select my query values to pass to the Form Filter.

Thanks for you help.
 
HisEnergy . . .

Perhaps the [blue]Column[/blue] property of a combobox will help! . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top