Open record from subform with the same ID in another form?

_Nickel_

Registered User.
Local time
Today, 13:03
Joined
Nov 11, 2003
Messages
31
I don't really know whether this belongs into forms, macros or VBA so I'll just post it here. :confused:

I am making a hardware & software inventory database. I have got all the data on each PC stored in tblPC which is linked to the Software table in a many-to-many relationship.
One of my forms has the PC data in the main form and software in a subform. Another form is based solely on the tblSoftware and has more details about the software than the Software-subform.
I would like to create a button in the PC form that opens up the record in the software form that corresponds to the currently selected record in the software subform (it doesn't necessarily have to be a button, it could a also it could also be an event procedure linked to double-clicking a record in the software subform).

I hope you understand what I mean as I find it quite hard to explain.

Any help greatly appreciated!
 
IF I have understood you correctly:

You could use the On Double Click event of the subform (form) to achieve your task.

Add the following code to your subform. The user can then double click the record selector to view more details.

Code:
Private Sub Form_DblClick(Cancel As Integer)
DoCmd.OpenForm "Frm_Software", , , "[SoftwareID]=" & Me.SoftwareID
End Sub

Brad.
 
Thanks (both of you), it's working!
One more question though:

All my forms (frmPC, frmSoftware etc.) are tabs in one main form. How do I need to modify Brad's code for it to switch to the tab of the software form instead of opening the form in a new window?


PS: Is there any way to edit the subject of the thread, I just realized that it doesn't make any sense. :rolleyes:
 

Users who are viewing this thread

Back
Top Bottom