Open a Related Spouse Record with Microsoft Access VBA
Question details
Open a spouse’s related member record by double-clicking the spouse control on an Access form.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A member form displays a spouse’s name, and the user wants to navigate to that spouse’s record.
- Observed behavior
- Double-clicking the spouse control should move the form to the matching member record.
Identify the spouse control and the member primary-key field in the form’s record source. Check whether the control stores a numeric spouse ID or only the displayed name, and make sure the target record is included in the form’s current recordset.
Find the spouse record by its unique ID
Use this method when the spouse control stores a numeric member ID while displaying the spouse’s name.
A unique ID avoids ambiguity when members have the same name. The example assumes the control is named Echtgenoot and the numeric primary-key field is named MemberID.
Open the form in Design View, select the spouse combo box, and check its Property Sheet. Configure its row source and Bound Column so its value is the spouse’s numeric member ID while the visible column shows the name.
On the spouse control’s Property Sheet, select the Event tab. Set On Dbl Click to [Event Procedure], then click the build button to open the VBA editor.
In the Echtgenoot_DblClick procedure, add the following code, replacing MemberID or Echtgenoot if your names differ: Private Sub Echtgenoot_DblClick(Cancel As Integer) If IsNull(Me.Echtgenoot.Value) Then Exit Sub With Me.RecordsetClone .FindFirst "[MemberID] = " & CLng(Me.Echtgenoot.Value) If .NoMatch Then Beep Else Me.Bookmark = .Bookmark End If End With End Sub
Save the form, switch to Form View, and double-click a spouse’s name. The form should move to the matching member record; a beep indicates that no match was found in the current recordset.

Find the spouse record by name
Use this alternative if the spouse control stores a name rather than a member ID.
Use WPS Office for Related Office Documents
WPS Office is a free, lightweight alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format support make it easy to bring existing files across. Microsoft Access is still needed to run the database form and its VBA event.

Frequently Asked Questions
Why should the spouse control store an ID instead of a name?
A primary key uniquely identifies the spouse, while names can be duplicated or changed. In the combo box’s Property Sheet, configure the row source and Bound Column to store the ID while displaying the name.
Why does the form beep instead of opening the spouse record?
The beep means FindFirst did not find a match in the form’s current recordset. Check the stored spouse value, the lookup field name, and any form filters that might exclude the target record.
Where do I add the double-click VBA code?
Open the form in Design View, select the spouse control, and go to Property Sheet > Event. Set On Dbl Click to [Event Procedure] and click the build button to open the VBA editor.
What happens if two members have the same name?
A name-based FindFirst search selects the first matching record in the current recordset. Store and search for the spouse’s unique member ID to distinguish between them.




