Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: More Form/SubForm Issues

Geek News

More Form/SubForm Issues
TeeSee <bkeanie[ at ]glasscellisofab.com> 11/30/2008 10:19:16 PM
Help required as usual. The Cmd button sits on a [mainform] while the
SISitemCode resides on a subform on the [mainform]. The [MainForm]
opens but is blank. I think I'm missing some path to the subForm

Private Sub cmdCloneItem_Click()
DoCmd.OpenForm "frmMaterialMasterADD", , , "[SISitemCode] = " & Chr
$(34) & SISItemCode & Chr$(34)
End Sub

Any assistance would be appreciated.
Re: More Form/SubForm Issues
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/1/2008 5:55:37 PM
"TeeSee" wrote in message
news:c1e600ec-9ef1-4492-83e6-8079da1112a2[ at ]k8g2000yqn.googlegroups.com...
[Quoted Text]
> Help required as usual. The Cmd button sits on a [mainform] while the
> SISitemCode resides on a subform on the [mainform]. The [MainForm]
> opens but is blank. I think I'm missing some path to the subForm
>
> Private Sub cmdCloneItem_Click()
> DoCmd.OpenForm "frmMaterialMasterADD", , , "[SISitemCode] = " & Chr
> $(34) & SISItemCode & Chr$(34)
> End Sub
>
> Any assistance would be appreciated.


So you're trying to refer to the SISItemCode field on the subform? To do
that, you need to include the subform itself in the reference -- that is,
the name of the subform *control* on the main form that acts as a window for
the subform. The name of the subform control may or may not be the name of
the form object it displays; yuo have to check that.

If the subform control were named "Subform1", then your code to refer to the
control on the subform would be:

DoCmd.OpenForm "frmMaterialMasterADD", , , _
"[SISitemCode] = " & Chr$(34) & Me!Subform1!SISItemCode & Chr$(34)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: More Form/SubForm Issues
Marshall Barton <marshbarton[ at ]wowway.com> 12/1/2008 6:39:06 PM
Note that in the newer versions of Access, you need to use
the Form property on your way to a control/property in a
subform:

... = " & Chr$(34) & Me!Subform1.FORM!SISItemCode & ...

--
Marsh
MVP [MS Access]
Re: More Form/SubForm Issues
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/1/2008 8:19:00 PM
"Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message
news:ljb8j49eisqkucrj0nr1rlciejcgptpe4c[ at ]4ax.com...
[Quoted Text]
> Note that in the newer versions of Access, you need to use
> the Form property on your way to a control/property in a
> subform:
>
> ... = " & Chr$(34) & Me!Subform1.FORM!SISItemCode & ...


What version, Marsh? I've heard that said, but I haven't found that to be
the case with Access 2002 or 2003. Are there special circumstances in which
the simple SubformControlName!ControlName syntax doesn't work?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: More Form/SubForm Issues
TeeSee <bkeanie[ at ]glasscellisofab.com> 12/1/2008 11:22:06 PM
On Dec 1, 3:19 pm, "Dirk Goldgar"
<d...[ at ]NOdataSPAMgnostics.com.invalid> wrote:
[Quoted Text]
> "Marshall Barton" <marshbar...[ at ]wowway.com> wrote in message
>
> news:ljb8j49eisqkucrj0nr1rlciejcgptpe4c[ at ]4ax.com...
>
> > Note that in the newer versions of Access, you need to use
> > the Form property on your way to a control/property in a
> > subform:
>
> > ... = " & Chr$(34) & Me!Subform1.FORM!SISItemCode & ...
>
> What version, Marsh?  I've heard that said, but I haven't found that to be
> the case with Access 2002 or 2003.  Are there special circumstances in which
> the simple SubformControlName!ControlName syntax doesn't work?
>
> --
> Dirk Goldgar, MS Access MVPwww.datagnostics.com
>
> (please reply to the newsgroup)

For the record I am using Access 2003 and both of your suggestions
work equally well. Thank you for your responses

Strangely enough it also can be accomplished by the following
code ....

DoCmd.OpenForm "frmMaterialMasterADD", , , "[SISitemCode]='" & Forms!
[frmMainList]![SfrmItemsListSUB]![SISItemCode] & "'"

To be very honest I don't really understand that one but saw it posted
on one of the MANY subform questions.

Thanks again!
Re: More Form/SubForm Issues
Marshall Barton <marshbarton[ at ]wowway.com> 12/1/2008 11:26:34 PM
Dirk Goldgar wrote:

[Quoted Text]
>"Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message
>news:ljb8j49eisqkucrj0nr1rlciejcgptpe4c[ at ]4ax.com...
>> Note that in the newer versions of Access, you need to use
>> the Form property on your way to a control/property in a
>> subform:
>>
>> ... = " & Chr$(34) & Me!Subform1.FORM!SISItemCode & ...
>
>
>What version, Marsh? I've heard that said, but I haven't found that to be
>the case with Access 2002 or 2003. Are there special circumstances in which
>the simple SubformControlName!ControlName syntax doesn't work?


That's odd, I ran into it all over the place until I learned
to always use .Form

I just ran a simple test in A2003 and got the expected
property or method not found message.

I have no idea why you would not see it. Perhaps it has
something to do with a converted vs new db or file format or
???


--
Marsh
MVP [MS Access]
Re: More Form/SubForm Issues
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/1/2008 11:53:32 PM
"Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message
news:2sr8j41jgvof4b0o4b74ddhb0kkh40q8o3[ at ]4ax.com...
[Quoted Text]
>
> That's odd, I ran into it all over the place until I learned
> to always use .Form
>
> I just ran a simple test in A2003 and got the expected
> property or method not found message.
>
> I have no idea why you would not see it. Perhaps it has
> something to do with a converted vs new db or file format or
> ???


I don't know. I ran a simple test in A2003 just to confirm, and the old,
simple notation worked fine. But I've heard other people talk about this,
so I know you aren't just making it up. Would you be willing to send me a
sample DB so I can see what the difference is?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: More Form/SubForm Issues
Marshall Barton <marshbarton[ at ]wowway.com> 12/3/2008 2:09:50 PM
Dirk Goldgar wrote:

[Quoted Text]
>"Marshall Barton" wrote
>>
>> That's odd, I ran into it all over the place until I learned
>> to always use .Form
>>
>> I just ran a simple test in A2003 and got the expected
>> property or method not found message.
>>
>> I have no idea why you would not see it. Perhaps it has
>> something to do with a converted vs new db or file format or
>> ???
>
>
>I don't know. I ran a simple test in A2003 just to confirm, and the old,
>simple notation worked fine. But I've heard other people talk about this,
>so I know you aren't just making it up. Would you be willing to send me a
>sample DB so I can see what the difference is?


I put together a simple test, zipped and sent it this
morning. Let me know if you don't get it.

--
Marsh
MVP [MS Access]
Re: More Form/SubForm Issues
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/3/2008 5:23:31 PM
"Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message
news:8l4dj4904o422c9a4qqmbuph3ojth5hjeq[ at ]4ax.com...
[Quoted Text]
>
> I put together a simple test, zipped and sent it this
> morning. Let me know if you don't get it.


I haven't received it yet. Did you remove "NO SPAM" and ".invalid" from my
e-mail address? Of course, you can always get my e-mail address from my
website. I'll try replying to your e-mail address as listed above, but I
expect that's a spam trap.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: More Form/SubForm Issues
Marshall Barton <marshbarton[ at ]wowway.com> 12/3/2008 7:15:10 PM
Dirk Goldgar wrote:

[Quoted Text]
>"Marshall Barton" <marshbarton[ at ]wowway.com> wrote in message
>news:8l4dj4904o422c9a4qqmbuph3ojth5hjeq[ at ]4ax.com...
>>
>> I put together a simple test, zipped and sent it this
>> morning. Let me know if you don't get it.
>
>
>I haven't received it yet. Did you remove "NO SPAM" and ".invalid" from my
>e-mail address? Of course, you can always get my e-mail address from my
>website. I'll try replying to your e-mail address as listed above, but I
>expect that's a spam trap.


Yes, I have your correct email adddress.

My address is not a spam trap and, yes, I get a lot of spam,
but my ISP is fairly aggresive about filtering it out so
it's managable.

I got your email and included another copy of the file in my
reply.

--
Marsh
MVP [MS Access]
Re: More Form/SubForm Issues
Marshall Barton <marshbarton[ at ]wowway.com> 12/5/2008 7:06:11 PM
Marshall Barton wrote:

[Quoted Text]
>Note that in the newer versions of Access, you need to use
>the Form property on your way to a control/property in a
>subform:
>
> ... = " & Chr$(34) & Me!Subform1.FORM!SISItemCode & ...


I need to retract this note. I misread the reference as
using:
... = " & Chr$(34) & Me!Subform1.SISItemCode & ...
with a dot unstead of a bang (which does require the Form
property).

Don't ask me to explain why, but using bang:
... = " & Chr$(34) & Me!Subform1!SISItemCode & ...
does not need the Form property.

Whether or not it is a good practice to always use the Form
property when going through a subform control is a
discussion for another day.

--
Marsh
MVP [MS Access]

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net