Search Records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to design a form to search spare parts records by description rather
than part number. That is, the user types in PUMP in a text box and the query
returns all records with the word PUMP in its description to a list box on
the same form.
Bearing in mind a description might read "DRAIN PUMP ASSY-MAYTAG MAV SERIES"
Any suggestions as to how I would go about this?
 
I want to design a form to search spare parts records by description rather
than part number. That is, the user types in PUMP in a text box and the query
returns all records with the word PUMP in its description to a list box on
the same form.
Bearing in mind a description might read "DRAIN PUMP ASSY-MAYTAG MAV SERIES"
Any suggestions as to how I would go about this?

You could have a textbox, txtSearch let's call it; base your Listbox
on a query

SELECT PartNumber, Description
FROM Parts
WHERE Description LIKE "*" & [Forms]![YourForm]![txtSearch] & "*"
ORDER BY PartNumber;

(or perhaps order by description, whichever works better for you).

You'll need to requery the listbox in the AfterUpdate event of
txtSearch.

John W. Vinson [MVP]
 
Thank you for that John, looks exactly what I want......however, I'm getting
a VB error: "Compile Error....Expected Function or variable."

Private Sub txtSearch_AfterUpdate() - (is highlighted in yellow)
Me.Requery.List2
End Sub

DonK


John W. Vinson said:
I want to design a form to search spare parts records by description rather
than part number. That is, the user types in PUMP in a text box and the query
returns all records with the word PUMP in its description to a list box on
the same form.
Bearing in mind a description might read "DRAIN PUMP ASSY-MAYTAG MAV SERIES"
Any suggestions as to how I would go about this?

You could have a textbox, txtSearch let's call it; base your Listbox
on a query

SELECT PartNumber, Description
FROM Parts
WHERE Description LIKE "*" & [Forms]![YourForm]![txtSearch] & "*"
ORDER BY PartNumber;

(or perhaps order by description, whichever works better for you).

You'll need to requery the listbox in the AfterUpdate event of
txtSearch.

John W. Vinson [MVP]
 
John, have realised my error. I re-phrased the After Update to: list2.requery
and it's now working perfectly. Thanks again.
--
DonK


DonK said:
Thank you for that John, looks exactly what I want......however, I'm getting
a VB error: "Compile Error....Expected Function or variable."

Private Sub txtSearch_AfterUpdate() - (is highlighted in yellow)
Me.Requery.List2
End Sub

DonK


John W. Vinson said:
I want to design a form to search spare parts records by description rather
than part number. That is, the user types in PUMP in a text box and the query
returns all records with the word PUMP in its description to a list box on
the same form.
Bearing in mind a description might read "DRAIN PUMP ASSY-MAYTAG MAV SERIES"
Any suggestions as to how I would go about this?

You could have a textbox, txtSearch let's call it; base your Listbox
on a query

SELECT PartNumber, Description
FROM Parts
WHERE Description LIKE "*" & [Forms]![YourForm]![txtSearch] & "*"
ORDER BY PartNumber;

(or perhaps order by description, whichever works better for you).

You'll need to requery the listbox in the AfterUpdate event of
txtSearch.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top