Run time error 438

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
 
R

rferrari27

Well, finally I solved the problem; it was a matter of "form".
The correct pathname is the following:

Set rs = Forms!Main!SubfCtrl.Form.Recordset.Clone
Forms!Main!SubfCtrl.Form.Bookmark = rs.Bookmark

(please note the word 'Form' after the subform ctrl name)

Hope it can help.
rf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top