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

Grouping and Selecting on Screen

Status
Not open for further replies.

MikeRBS

IS-IT--Management
Apr 15, 2004
81
GB
I have a list of items I would like to display grouped by a grouping field, with the grouping field displayed as a sub-heading. This is the sort of thing you can easily do on a report. However I want to allow the user to double click on an entry and have a full screen form appear showing the full details of the selected item. I'm assuming you can't attach an event to a detail control of a report as I'm not aware of a referencing mechanism ie how you would pick up which of the variable number of lines had been clicked.

Any ideas how to achieve this functionality?

 
Use the OpenForm method of the DoCmd command and add a WHERE clause

Code:
DoCmd.OpenForm "Employees", , ,"LastName = 'King'"

FOr more info, see the on-line Help topic OpenForm Method

HTH
Lightning
 
It won't be King. It will be a reference to a control on a form or report, something like [TxtBox434]. This may well have the value King but equally it could have any other value depending on which record they decide to click on or otherwise select. The issue is how do I display grouped detail lines and still be able to refer to the particular instance the user clicked on/selected etc in order to build the recordset for the detail screen.
 
The code in my first post was just an example of how you can open a second form to a specific record. To pass a variable to the code you would use something like

Code:
DoCmd.OpenForm "Employees", , ,"LastName = " & Me.[MyLastNameField]

where Me is an Access Keyword that refers to the form where the code is being run from and [MyLastNameField] is the name of the field used to uniquely identify the specific record(s) required.

HTH
Lightning
 
I can see this for a single form but where you have multiple detail lines on a screen (datasheet, report or continuous forms) how do you refer to the particular [MyLastNameField] that has just been clicked?
 
You specify instead of using Me.[MyLastNameField]

something like:

[FormName]![SubformName]![ControlName]

Leslie
 
Well, using a report is off the cards as I see there are no click-type events. I can only see format, print, retreat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top