Group:  Microsoft Access » microsoft.public.access.adp.sqlserver
Thread: form name in openargs

Geek News

form name in openargs
JEM <Jenn[ at ]JEMConsulting.org> 12/12/2008 5:48:19 PM
I am trying to do something that seems like it should be simple, but i
can't get it right. I have a popup form for users to enter or edit
organizations (frmOrganizations) that can be opened from various forms
in the database by double clicking on a control (cboOrganization). I
want to be able to send the name of the form in the openargs when they
double click so that when they finish entering or editing the
organization, the control (cboOrganization) can be populated with the
value they entered or requeried. I thought i could do it this way
rather than having to look for the originating form using
currentproject.allforms. Any ideas?

Thanks,
Jenn
Re: form name in openargs
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 12/13/2008 3:24:40 AM
On Fri, 12 Dec 2008 09:48:19 -0800 (PST), JEM <Jenn[ at ]JEMConsulting.org>
wrote:

DoCmd.OpenForm "frmOrganizations", OpenArgs:=Me.Name

-Tom.
Microsoft Access MVP


[Quoted Text]
>I am trying to do something that seems like it should be simple, but i
>can't get it right. I have a popup form for users to enter or edit
>organizations (frmOrganizations) that can be opened from various forms
>in the database by double clicking on a control (cboOrganization). I
>want to be able to send the name of the form in the openargs when they
>double click so that when they finish entering or editing the
>organization, the control (cboOrganization) can be populated with the
>value they entered or requeried. I thought i could do it this way
>rather than having to look for the originating form using
>currentproject.allforms. Any ideas?
>
>Thanks,
>Jenn
Re: form name in openargs
JEM <Jenn[ at ]JEMConsulting.org> 12/15/2008 2:59:46 PM
On Dec 12, 10:24 pm, Tom van Stiphout <tom7744.no.s...[ at ]cox.net> wrote:
[Quoted Text]
> On Fri, 12 Dec 2008 09:48:19 -0800 (PST), JEM <J...[ at ]JEMConsulting.org>
> wrote:
>
> DoCmd.OpenForm "frmOrganizations", OpenArgs:=Me.Name
>
> -Tom.
> Microsoft Access MVP
>
>
>
> >I am trying to do something that seems like it should be simple, but i
> >can't get it right.  I have a popup form for users to enter or edit
> >organizations (frmOrganizations) that can be opened from various forms
> >in the database by double clicking on a control (cboOrganization). I
> >want to be able to send the name of the form in the openargs when they
> >double click so that when they finish entering or editing the
> >organization, the control (cboOrganization) can be populated with the
> >value they entered or requeried.  I thought i could do it this way
> >rather than having to look for the originating form using
> >currentproject.allforms.  Any ideas?
>
> >Thanks,
> >Jenn- Hide quoted text -
>
> - Show quoted text -

Thanks, i got that part, the part that i can't figure out how to do is
to requery the control on the form based on what the value of the
openargs is. You can't do Forms!me.openargs!cboOrganization.Requery.
I also tried:

Dim frm As Form
Set frmname = me.openargs
forms!frmname!cboOrganization.requery

Doesn't work either. Any ideas?
Re: form name in openargs
Tom van Stiphout <tom7744.no.spam[ at ]cox.net> 12/17/2008 2:15:07 PM
On Mon, 15 Dec 2008 06:59:46 -0800 (PST), JEM <Jenn[ at ]JEMConsulting.org>
wrote:

Forms(Me.OpenArgs)!cboOrganization.requery

-Tom.
Microsoft Access MVP


<clip>
[Quoted Text]
>
>Thanks, i got that part, the part that i can't figure out how to do is
>to requery the control on the form based on what the value of the
>openargs is. You can't do Forms!me.openargs!cboOrganization.Requery.
>I also tried:
>
>Dim frm As Form
>Set frmname = me.openargs
>forms!frmname!cboOrganization.requery
>
>Doesn't work either. Any ideas?
Re: form name in openargs
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)> 12/31/2008 10:40:12 PM
"JEM" <Jenn[ at ]JEMConsulting.org> wrote in message
news:bd181e23-5fc5-411a-a533-cb9dde785d43[ at ]n33g2000pri.googlegroups.com...
On Dec 12, 10:24 pm, Tom van Stiphout <tom7744.no.s...[ at ]cox.net> wrote:
[Quoted Text]
> On Fri, 12 Dec 2008 09:48:19 -0800 (PST), JEM <J...[ at ]JEMConsulting.org>
> wrote:
>
> DoCmd.OpenForm "frmOrganizations", OpenArgs:=Me.Name
>
> -Tom.
> Microsoft Access MVP
>
>
> >I am trying to do something that seems like it should be simple, but i
> >can't get it right. I have a popup form for users to enter or edit
> >organizations (frmOrganizations) that can be opened from various forms
> >in the database by double clicking on a control (cboOrganization). I
> >want to be able to send the name of the form in the openargs when they
> >double click so that when they finish entering or editing the
> >organization, the control (cboOrganization) can be populated with the
> >value they entered or requeried. I thought i could do it this way
> >rather than having to look for the originating form using
> >currentproject.allforms. Any ideas?
>
> >Thanks,
> >Jenn- Hide quoted text -
>
> - Show quoted text -

> Thanks, i got that part, the part that i can't figure out how to do is
> to requery the control on the form based on what the value of the
> openargs is. You can't do Forms!me.openargs!cboOrganization.Requery.
> I also tried:
>
> Dim frm As Form
> Set frmname = me.openargs
> forms!frmname!cboOrganization.requery
>
> Doesn't work either. Any ideas?

Me.OpenArgs is a string, not a form; so as Tom has said, you must write
something like:

Dim frm As Form
Set frmname = Forms (me.openargs)
frm!cboOrganization.requery

You could also add a public variable to your frmOrganizations form and
populates it with the current form (untested):

' On the frmOrganizations form:
Public frm As Form

' When opening the frmOrganizations form from another form:
DoCmd.OpenForm "frmOrganizations", acNormal
Set Forms("frmOrganizations").frm = Me
...

When you are finished with it, you can reset the value of frm to Null in
order to catch any glitch.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


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