Creating Query from Presently Active Record

  • Thread starter Thread starter L.A. Lawyer
  • Start date Start date
L

L.A. Lawyer

I want to create a single record query from my People database that will
contain only the record active in the current form using the autogenerated
field of PeopleID to eliminate all other records. I want to have that
record use all of the fields and characteristics of the currently active
recordset (itself a query).

How is that done?
 
Create another query based on the existing query that is the basis of the form.
Use the query wizard and select all the fields to include in the new query. In
the PeopleID field, put this expression in the query:
Forms!NameOfYourForm!PeopleID
The new query will always return one record and it will be the record that is
currently displayed in your form.

What you are asking how to do is very unconventional! Tell us what you are
trying to do and there is probably a better way to do it.
 
I am trying to set up a single record database so that I can use it in MS
Word 2000 to import data which I will be placing in Word documents by
bookmarks of the same name as the Access 2000 field.
 
You don't need to do what you state in your original post! Just use automation
to call up the Word template and use code that looks like in a command button on
your form:
NameBookmark = Me!PeopleName
AddressBookmark = Me!Address
CityStateZip Bookmark = Me!CityStateZip

You will create a single document where the bookmarks will be filled in with the
values in the fields on the screen.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
 
I do this all the time. The way I do it is I create a
query and in the Criteria row of the query, I reference a
control on the form which contains the Unique/key field
data of the table the form is based on. For example:

in the Criteria row and the PersonID column (for example)
I type:
=Forms![NameOfForm]![NameOfControl].

Then, when I execute the query, either by a button or
openform or whatever, it runs the query and calls up only
those records where the PersonID is equal to the one shown
in the PersonID control on the active form. AND THERE
SHOULD ONLY BE ONE RECORD SINCE IT IS IN THE KEY FIELD!
If you want to, you can make the control invisible, or
disabled, or locked or whatever. You can also refer to
the data directly if it is in a subform. You can also
criteria other fields in the query in case you have a
multi-field key. There are many ways of dealing with this
but they all call up a query that has criteria that is
referred to in a form.

If you can't figure it out from here, email me.
 
Back
Top