R
rferrari27
Hi all,
I have problems addressing a subform from a dialog form.
I have a main form with several subforms; a subform lists records
about generic personal info such as name, surname, address, etc.
This subform has a button for searching a record by name and surname;
by clicking on the button it opens a dialog form that prompts for name
and surname to search; the dialog form has an "ok" button to start the
search.
Here is the problem: I am not able to address the subform from the
dialog form in order to clone the record set and to set the bookmark for
the subform.
Below you'll find the sample code I wrote for the "click" event of the "ok"
button.
Let's say:
1. "Main" is the ctrl name of the main form;
2. "SubfCtrl" is the ctrl name of the subform;
3. I checked the control name of the subform (even with debug commands);
=================
Dim strSearch as String 'the name/surname to search for
Dim rs As Object
Set rs = Forms!Main!SubfCtrl.Recordset.Clone '<<< Error comes here
<<code to set strSearch not included>>
rs.findfirst strSearch
If Not rs.noMatch Then
Forms!Main!SubfCtrl.Bookmark = rs.Bookmark
EndIf
=================
The error I got is the following:
"Run time error 438: Object doesn't support this property or method"
I hope someone can point me in the right direction. Thanks in advance
for any responses.
Roberto
I have problems addressing a subform from a dialog form.
I have a main form with several subforms; a subform lists records
about generic personal info such as name, surname, address, etc.
This subform has a button for searching a record by name and surname;
by clicking on the button it opens a dialog form that prompts for name
and surname to search; the dialog form has an "ok" button to start the
search.
Here is the problem: I am not able to address the subform from the
dialog form in order to clone the record set and to set the bookmark for
the subform.
Below you'll find the sample code I wrote for the "click" event of the "ok"
button.
Let's say:
1. "Main" is the ctrl name of the main form;
2. "SubfCtrl" is the ctrl name of the subform;
3. I checked the control name of the subform (even with debug commands);
=================
Dim strSearch as String 'the name/surname to search for
Dim rs As Object
Set rs = Forms!Main!SubfCtrl.Recordset.Clone '<<< Error comes here
<<code to set strSearch not included>>
rs.findfirst strSearch
If Not rs.noMatch Then
Forms!Main!SubfCtrl.Bookmark = rs.Bookmark
EndIf
=================
The error I got is the following:
"Run time error 438: Object doesn't support this property or method"
I hope someone can point me in the right direction. Thanks in advance
for any responses.
Roberto