What you are thinking of is using variable values in a query. This is a frequent practice in Access and there are a few ways to design the functionality. Typically you will have a query that returns data and a form which provides the user interface to interact with the query. The results could be displayed directly from the query or even better on a another or the same form
Here's an example of a function which could be used as the criteria of a query. It refers to a textbox on a form the form would have to be active when the query is run.
Like ("*" & [Forms]![frmLookUp]![txtInput] & "*")
Another way would be to run a query dynamically or create a query string in a procedure that can be applied to the Recordsource property of the form or returned in a recordset. Part of the code might look like this...
strCriteria = Me![txtInput]
strQry = "SELECT ITEM.* " & _
" FROM tblITEM " & _
" WHERE (((ITEM.ID)='" & strCriteria & "'))"