Double-click on subform record to display record in separate form for better view (1 Viewer)

CoddFish

Registered User.
Local time
Yesterday, 23:32
Joined
May 26, 2003
Messages
36
I have a form with a subform. The subform is the typical format with each record displayed horizonatally in a grid. I would like to be able to double-click on a single record to open another form that will display just that record for viewing, and for add/edit/delete. Each record contains two fields: Note, and NoteDate. Note is memo-sized and NoteDate is an automatically-generated date stamp (i.e., uses the Date() function).

Thanks!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:32
Joined
Feb 19, 2002
Messages
42,981
You can open a zoombox if you have only the note field to look at. Or, use the OpenForm Method to open a new form. Use the where argument to supply the linking key information so that the new form is properly synchronized.
 

Oldsoftboss

AWF VIP
Local time
Today, 16:32
Joined
Oct 28, 2001
Messages
2,504
A simplistic view on what Pat suggests.

Create a form that you want to use to view the record. Use the same record source as the subform.

In design view of the original subform use the access wizard to create a command button to open this form and show one record. (The wizard will ask the question.)

Then in the form properties double click event put:

Call cmdButtonName_Click

Remember you wont see the cmd button when the form is in datasheet view.
Now when you doubleclick on the record selector on the LHS of the datasheet subform the other form should open at that record.

PS: You can transfer the code to the double click event if you like.

Good luck :)
Dave
 
Last edited:

CoddFish

Registered User.
Local time
Yesterday, 23:32
Joined
May 26, 2003
Messages
36
OldSoftBoss,

I did as you described and it works, with one limitation: I am not able to create a record in the second form; only edit/delete a record that has already been created in the original subform. My intuition tells me that this has something to do with appropriately linking keys, but I'm not exactly sure how to solve the problem. Any insight would be greatly appreciated.
 

Oldsoftboss

AWF VIP
Local time
Today, 16:32
Joined
Oct 28, 2001
Messages
2,504
If you look in the status bar you will see the form is filtered, displaying only one record.

Here's another method, which uses the Find Method

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "NewFormName"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms![NewFormName]![IDField].Enabled = True
Forms![NewFormName]![IDField].SetFocus
DoCmd.FindRecord Me![IDField] 'The field in the subform
Forms![NewFormName]![SomeOtherField].SetFocus
Forms![NewFormName]![IDField].Enabled = False

If the ID field is hidden on your new form you will need to make it visible, but you can make it very small (the size of a dot)

This way the form is available with all the records and the ability to add /edit etc

Dave
 

Users who are viewing this thread

Top Bottom