Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Trying to call a procedure in a subform

Geek News

Trying to call a procedure in a subform
SecretAgent 11/29/2008 5:28:05 PM
I have been trying to figure out how to do this on my own but I am stumped.

When I use
DoCmd.RunCommand acCmdRecordsGoToNew
or
DoCmd.GoToRecord , , acNewRec
on the main form the subform does not seem to move to a new record. What is
the best way to do this? Thanks for the help!

Re: Trying to call a procedure in a subform
"Ken Snell \(MVP\)" <kthsneisllis9[ at ]ncoomcastt.renaetl> 11/29/2008 6:11:47 PM
The subform needs to be running that code, not the main form.
DoCmd.RunCommand actions can produce unexpected results, as you're seeing.

Try this code from the main form (replace NameOfSubformControlOnMainForm
with the actual name of the control on the main form that holds the
subform):

Me.NameOfSubformControlOnMainForm.Form.Recordset.AddNew

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"SecretAgent" <SecretAgent[ at ]discussions.microsoft.com> wrote in message
news:7FD28015-8333-4BC4-9F0E-4C4FFA808AFC[ at ]microsoft.com...
[Quoted Text]
>I have been trying to figure out how to do this on my own but I am stumped.
>
> When I use
> DoCmd.RunCommand acCmdRecordsGoToNew
> or
> DoCmd.GoToRecord , , acNewRec
> on the main form the subform does not seem to move to a new record. What
> is
> the best way to do this? Thanks for the help!
>


Re: Trying to call a procedure in a subform
SecretAgent 11/29/2008 9:10:00 PM
That worked. Thanks for your help!

"Ken Snell (MVP)" wrote:

[Quoted Text]
> The subform needs to be running that code, not the main form.
> DoCmd.RunCommand actions can produce unexpected results, as you're seeing.
>
> Try this code from the main form (replace NameOfSubformControlOnMainForm
> with the actual name of the control on the main form that holds the
> subform):
>
> Me.NameOfSubformControlOnMainForm.Form.Recordset.AddNew
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
> http://www.accessmvp.com/KDSnell/
>
>
> "SecretAgent" <SecretAgent[ at ]discussions.microsoft.com> wrote in message
> news:7FD28015-8333-4BC4-9F0E-4C4FFA808AFC[ at ]microsoft.com...
> >I have been trying to figure out how to do this on my own but I am stumped.
> >
> > When I use
> > DoCmd.RunCommand acCmdRecordsGoToNew
> > or
> > DoCmd.GoToRecord , , acNewRec
> > on the main form the subform does not seem to move to a new record. What
> > is
> > the best way to do this? Thanks for the help!
> >
>
>
>

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