Reusing a sub form

Mark Wild

Registered User.
Local time
Today, 21:39
Joined
Apr 9, 2003
Messages
126
I've got a sub form that gets re-used on a number of forms. It is controlled by the same control (combobox) on each of the main forms.

The sub form gets its data from a recordsource that is an sql statement. I can get it to work by naming the main form in the criteria (ie me.cmbClientID=FrmMain.cmbclientID) but don't want to hard code the name of form.

I am struggling to get the sub form to pick up the parent form in order to use it in the SQL crieteria.

Code:
set frm=me.parent

strSQL="select some.fields " _
            & "Where Tbl.ClientId=" & frm.cmbClientID & ";"

set rst=db.opendynaset(strSQL,dbopensnapshot)

I've also tried playing around with screen.activeform but had no luck
 

Users who are viewing this thread

Back
Top Bottom