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

Lookup Records On a Form

Status
Not open for further replies.

spam

Programmer
Nov 29, 2001
17
IE
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?


Thanks
 
There are several ways to search for records. You can filter, filter by form, search by field, search all fields, ....

What exactly do you want to do?
 
On the form, I would like to look up data on a table.

Lets says I want to search for a customer using his email address, I want to display the information on the form.

Thanks
 
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.


HTH,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top