A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I set a subform variable to the source object of a subform control?



 
 
Thread Tools Display Modes
  #1  
Old January 9th, 2007, 04:00 PM posted to microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Anthony
external usenet poster
 
Posts: 176
Default How do I set a subform variable to the source object of a subform control?

I'm trying to do something like this:

--
Dim sf as subform

set sf = forms(mySubFormControl.SourceObject)
--

But I keep getting this error:

"Microsoft Access can't find the form '(my form name)' referred to in a
macro expression or Visual Basic code.

please help

Anthony


  #2  
Old January 9th, 2007, 04:38 PM posted to microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default How do I set a subform variable to the source object of a subform control?

When a form is being used as a subform, it doesn't actually exist in the
Forms collection.

Not only that, but when you declare an object as a subform, you're actually
declaring the control that holds the form that's being used as a subform:
you don't believe you can assign a form to a subform control.

What exactly are you trying to accomplish?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Anthony" wrote in message
...
I'm trying to do something like this:

--
Dim sf as subform

set sf = forms(mySubFormControl.SourceObject)
--

But I keep getting this error:

"Microsoft Access can't find the form '(my form name)' referred to in a
macro expression or Visual Basic code.

please help

Anthony




  #3  
Old January 9th, 2007, 05:33 PM posted to microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
Anthony
external usenet poster
 
Posts: 176
Default How do I set a subform variable to the source object of a subform control?

nevermind, I figured it out. I changed the variable type from "form" to
"object" so I can use it for forms AND for subforms.


"Douglas J. Steele" wrote in message
...
When a form is being used as a subform, it doesn't actually exist in the
Forms collection.

Not only that, but when you declare an object as a subform, you're
actually declaring the control that holds the form that's being used as a
subform: you don't believe you can assign a form to a subform control.

What exactly are you trying to accomplish?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Anthony" wrote in message
...
I'm trying to do something like this:

--
Dim sf as subform

set sf = forms(mySubFormControl.SourceObject)
--

But I keep getting this error:

"Microsoft Access can't find the form '(my form name)' referred to in a
macro expression or Visual Basic code.

please help

Anthony






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.