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

Filtering Records in form according to criteria entered in combo box & txtbox.

Status
Not open for further replies.

plbobadilla

Technical User
Apr 18, 2013
2
0
0
US

Hello,

My name is Pablo and I am trying to set-up a form that can be filtered, but I keep having the issue where it only filters 1 record even though there should be multiple records that meet the filter criteria. Any help would be appreciated.


Here is the code for the Form:

Private Sub cmdsearch_WD_Click()
If Len(cbosearchcriteria_WD) = 0 Or IsNull(cbosearchcriteria_WD) = True Then
MsgBox "You must select criteria to search."

ElseIf Len(Txtsearchstring1_WD) = 0 Or IsNull(Txtsearchstring1_WD) = True Then
MsgBox "You must enter a search text."

Else

'Generate search criteria
WD_Criteria = cbosearchcriteria_WD.Value & " LIKE '*" & Txtsearchstring1_WD & "*'"

'Filter form based on search criteria
Form_Frm_Wire_Drawing.RecordSource = "select * from Wire_Drawing where " & WD_Criteria
Form_Frm_Wire_Drawing.Caption = "Wire_Drawing (" & cbosearchcriteria_WD.Value & " contains '*" & Txtsearchstring1_WD & "*')"


MsgBox "Results have been filtered."

End If

End Sub


Here is the code for the module:

Option Compare Database

'Global variable used to store search criteria
Global WD_Criteria As String





Thanks,

Pablo
 
Is Frm_Wire_Drawing continue or single ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
plbobadilla . . .

Are you asking for the right data from the combobox with WD_Criteria = cbosearchcriteria_WD[purple].Value[/purple] & " LIKE '*" & Txtsearchstring1_WD & "*'" ?

Which [blue]column[/blue] of the combobox are you after?

Post the [blue]RowSource[/blue] of the combobox.

[blue]Your Thoughts? ...[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hello,

Thanks for the quick responses.

Is Frm_Wire_Drawing continue or single ? - I am not sure what continue or single means, but this form has multiple tabs

Post the RowSource of the combobox. - The rowsource = "Work_Order" as a value list.

Thanks,

Pablo
 
@plbobadilla

PHV asking is that if your form is continuous form or single form?

 
plbobadilla . . .

A single form [blue]only shows one record at a time[/blue]. To the right of the navigation buttons (bottom left) you'll find how many records you can parse thru.

Also ... [blue]Work_Order[/blue] has to be a table or query name and can't be a value list. A value list has items seperated by semicolons.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top