Double Click on Selection in Subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have seen numerous Access applications where a form asks for certain
personal information, let's say LastName. Entry of this last name triggers a
subform display of all those in a database with that last name. I believe
this subform displays in datasheet format. The subform display includes
LastNames, FirstNames and addresses. The appropriate individual may be
selected with a single click, resulting in a high-lighting of that
individual. By high-lighting, I mean the background might go to black across
that particular record. A further double click on this high-lighted
individual opens a form in a new window displaying all the personal details
of the individual. While this seems somewhat standard, the methods and code
to get there evade me. Is there possible help or guidance out there? As
always, the great help available here is appreciated and invaluable.
 
1. Create a query based on your table of names and addresses.
a) Include PersonID in the first query field.
b) Include this expression in the second query field:
Person:[LastName] & ", " & [FirstName]
c) Include this expression in the thoird query field:
CityStateZip:[City] & ", " & [State] & " " & [Zipcode]
2. Create a continuous pop-up form based on the query in 1.
a) Name the form PFrmSearchForNames
b) Put the PersonID field at the far right and make it noe visible.
c) Put an unbound textbox named EnterLastNameHere in the form header.
d) Put the following code in the OnChange event of the textbox:
Me.Requery
e) Put this code in the Click event of the Person field:
DoCmd.OpenForm "NameOfDetailsForm",,,"[PersonID] = " &
Me!PersonID
3. Open the query in 1 in design view. Put the following expression in the
criteria of the Person field:
Like Forms!PFrmSearchForNames!EnterLastNameHere & "*"

The above assumes that the PK in the details form is PersonID. Clicking on
the Person field in the search form will open the details form to the person
that was clicked on.
 
Back
Top