Simple select query

L

Lisa

I have a table that lists land ownership records, i.e. land ID number,
owner's name, address, etc. I would like to build a simple select query to be
used with a user input box--for example, the user would type in a land ID
number and the record that corresponds with it would be returned (either in a
form or page).

Any help would be GREATLY appreciated!!

Thanks!
Lisa
 
R

Rick Brandt

I have a table that lists land ownership records, i.e. land ID number,
owner's name, address, etc. I would like to build a simple select query
to be used with a user input box--for example, the user would type in a
land ID number and the record that corresponds with it would be returned
(either in a form or page).

First create a form for your table. This form can then be opened with
the VBA function DoCmd.OpenForm. One optional argument of the OpenForm
method is a WHERE clause that applies a filter to the form being opened.
You will use that to open your form to the desired record...

DoCmd.OpenForm "FormName",,,,"LandID = 123"

Now build a small unbound form that contains a ListBox or ComboBox
displaying all of your LandID values. Add a button users will click on
to open your other form. Instead of a hard-coded WHERE clause value like
I used above you can refer to the LandID selected in the ComboBox or
ListBox...

DoCmd.OpenForm "FormName",,,,"LandID = " & Me.LandIDList

The line of code above would be called in the Click event of your button.
 

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

Top