Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2007

Tip: Looking for answers? Try searching our database.

subform not found on mainform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
W - 22 Dec 2007 07:38 GMT
Hi,

I have an unbound form “frmMainForm”in which I have a bound subform
“frmSubForm”.  I have a string strSQL which I use for the recordsource of
“frmSubForm” :

Set rst = db.OpenRecordset(strSQL)

I do not seem to be able to execute this command :
When I’m in the code of the main form, I have this line :

Me![frmSubForm].Form.RecordSource = strSQL

I get error 2465 : Access does not find frmSubForm.

Any help will be appreciated.

Thank you,

W
Jeanette Cunningham - 22 Dec 2007 07:45 GMT
Hi,
try it like this
Private sub MyRoutine()
Dim strSQL as String

       strSQL = "code or name of the query here"
       Me![Name of subform control].Form.RecordSource = strSQL
       debug.print strSQL

End Sub

> Hi,
>
[quoted text clipped - 16 lines]
>
> W
W - 22 Dec 2007 09:20 GMT
Hi Jeanette,

This is exactly what I do, and it does not work.  So, my question still
remains open.  Thanks for your suggestion anyhow.

W

> Hi,
> try it like this
[quoted text clipped - 27 lines]
> >
> > W
Rick Brandt - 22 Dec 2007 13:19 GMT
> Hi Jeanette,
>
> This is exactly what I do, and it does not work.  So, my question
> still remains open.  Thanks for your suggestion anyhow.

Is "frmSubForm" the name of the subform control, the name of the form contained
within the subform control, or both?

The syntax requires the name of the control, not the form.  In many cases the
subform control and the form within have the same name in which case it wouldn't
be an issue.  However; there is nothing that requires that they have the same
name and in those cases you need to use the name of the control.

You can see the name of the control by clicking (once) on its very edge while in
design view of the parent form.  If you click twice or click inside the
perimeter you will be seeing the properties of the underlying form rather than
the properties of the control.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

W - 22 Dec 2007 21:52 GMT
Yes, you were right, Rick.
It is working fine now.

Thank you very much.

W

> > Hi Jeanette,
> >
[quoted text clipped - 13 lines]
> perimeter you will be seeing the properties of the underlying form rather than
> the properties of the control.
W - 22 Dec 2007 09:22 GMT
What I forgot, Access does not find nor recognize the subform, the SQL-string
is valid.

W

> Hi,
> try it like this
[quoted text clipped - 27 lines]
> >
> > W
boblarson - 22 Dec 2007 20:05 GMT
Rick's advice is the part I would go with.  That is the problem 99% of the
time when it comes to errors around subforms.
Signature

Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________

> What I forgot, Access does not find nor recognize the subform, the SQL-string
> is valid.
[quoted text clipped - 32 lines]
> > >
> > > W
Jeanette Cunningham - 22 Dec 2007 09:33 GMT
Hi,
Perhaps some more details would help us.
Access version.
Is it Access with a Jet backend?
How many forms and subforms are nested?
Would post the exact wording of the error message?
What happens if you delete the subform, save the form, then go back and add
the subform.

Jeanette Cunningham

> Hi,
>
[quoted text clipped - 16 lines]
>
> W
W - 30 Dec 2007 07:47 GMT
Dear Jeanette,

Thanks for your answer, but Rick did already answer my question.  Thanks to
have  made an effort though.

W

> Hi,
> Perhaps some more details would help us.
[quoted text clipped - 27 lines]
> >
> > W
John Griffiths - 22 Dec 2007 16:46 GMT
Check to see if the drag amd drop operation added a numeral to the form name
to generate the control's name.

such as :-
Me![frmSubForm1].Form.RecordSource = strSQL

> Hi,
>
[quoted text clipped - 16 lines]
>
> W
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.