How can you look up records that are in a table on a form?
Is there a way that you can search for records from a form?
The answer to both questions is yes. In the first case you can use the
Dlookup function.
DLookup Function Example [From the on-line help]
The following example returns name information from the CompanyName field of the record satisfying criteria. The domain is a Shippers table. The criteria argument restricts the resulting set of records to those for which ShipperID equals 1.
Dim varX As Variant
varX = DLookup("[CompanyName]", "Shippers", "[ShipperID] = 1"
[CompanyName] => Field you want to search
Shippers => Name of Table/Query to search in
[ShipperID] = 1 => Criteria for returning records.
An answer to the second question would be to use what is known as QBF (Query By Form)
1 - Create a select query that you know will return the correct records.
2 - Create a form with the fields that you want to use as search values
3 - Set the criteria of the queries fields to be the fields on the form using syntax as follows:
Like [Forms]![SearchForm]![LastName]&"*"
4 - Create a command button on the form that will open the query that now has the
fields of the form as it's criteria. If the records you expect are returned then you
can create a form based on the query to show your results in a more stylish
manner if need be.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.