Passing variables to a new instance of a form

superchrisdub

New member
Local time
Today, 20:22
Joined
Mar 29, 2018
Messages
9
Hi,

I have a form that has client details on it, searchable by surname. One of the fields is the client’s partner/spouse. If double-clicked this should bring up a new instance of the same form, filtered on the spouse’s unique id. How can I achieve this. I have tried the following:
Dim frm as new Form_currentform
Frm.visible = true
This however changes the record selection in the current form. How do I best create the new instance and then pass a filter condition to it? I have tried Google Glass it but nothing I try seems to work. I think the problem is that I am calling a new instance of FormA from FormA.


Thanks
Chris
 
Not tested but you may try:

Option Compare Database
Option Explicit

Dim FormInstance As Form

Private Sub Form_Load()
Set FormInstance = Me
End Sub

Private Sub button_DblClick(Cancel As Integer)
Dim frm as new Form_currentform
Frm.Filter="[id]=" & [unique id]
Frm.FilterOn=True
Frm.visible = true
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom