Well, with a slight modification from what you have.
Code:
Function SearchName()
Dim ivalue As String
Dim strSQL As String
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb()
ivalue = InputBox("Please enter the name or portion of the name that you wish to search for.", "Customer Name Lookup")
strSQL = "SELECT * FROM CustList WHERE CustName LIKE '*" & ivalue & "*'"
With dbs
Set qdf = .QueryDefs("Search Results")
qdf.SQL = strSQL
qdf.Close
DoCmd.OpenQuery "Search Results", acViewNormal, acReadOnly
End With
Set dbs = Nothing
End Function
And I have no idea why yhou were using the recordset but I deleted it completely because from what you have there, it isn't needed at all. You also don't need to close dbs because it won't close it anyway as it is the current database and it needs to remain open, so it is moot.