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 / March 2005

Tip: Looking for answers? Try searching our database.

Setting form Variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark A. Sam - 04 Mar 2005 16:01 GMT
Hello,

I am trying to set a Form Variable depending on the value or Openargs.  This
is what I have...

Dim frm As Form
Dim strForm As Variant
strForm = "Forms![" & Parse(OpenArgs, 1, ";") & "]"
Set frm = strForm

WHERE

Parse(OpenArgs, 1, ";") =  SALES Confirmations New

strForm = Forms![SALES Confirmations New]

With this method I get an error... Run-time error 424: Object Required.

I've tried all different types of methods to assign the variable, frm,
without success.

This works however:  Set frm = Forms![SALES Confirmations New]

Thanks for any help.

Mark A. Sam
Ken Ismert - 04 Mar 2005 16:32 GMT
Try:

Set frm =  Forms( Parse(OpenArgs, 1, ";") )

Forms( ) allows you to specify a form using a variable value.

-Ken
Mark A. Sam - 04 Mar 2005 16:41 GMT
Thanks Ken,

That worked, but  Set frm = Forms(strForm) doesn't work.  Go figure.

God Bless,

Mark

> Try:
>
[quoted text clipped - 3 lines]
>
> -Ken
Marshall Barton - 04 Mar 2005 17:16 GMT
Mark,  Are you sure that the form [SALES Confirmations New]
is already open?

Please provide the error message if any, "doesn't work" is
just too vague for us to work with.
Signature

Marsh
MVP [MS Access]

>That worked, but  Set frm = Forms(strForm) doesn't work.  Go figure.
>
>> Set frm =  Forms( Parse(OpenArgs, 1, ";") )
Mark A. Sam - 04 Mar 2005 18:04 GMT
Marshall, positive.. the form name is passed to openargs.  I verify it in
the immediate window.

?strForm

> Mark,  Are you sure that the form [SALES Confirmations New]
> is already open?
[quoted text clipped - 4 lines]
> >
> >> Set frm =  Forms( Parse(OpenArgs, 1, ";") )
Marshall Barton - 04 Mar 2005 22:24 GMT
It was just a thought.

Good thing you have something that works.
Signature

Marsh
MVP [MS Access]

>Marshall, positive.. the form name is passed to openargs.  I verify it in
>the immediate window.
[quoted text clipped - 10 lines]
>> >
>> >> Set frm =  Forms( Parse(OpenArgs, 1, ";") )
Sandra Daigle - 04 Mar 2005 16:33 GMT
Try it this way instead  (assuming that PARSE is a userdefined function and
that it returns a string):

Dim frm As Form
Dim strForm As String
strForm="[" & Parse(OpenArgs, 1, ";") & "]"
set frm = forms(strform)

Signature

Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

> Hello,
>
[quoted text clipped - 23 lines]
>
> Mark A. Sam
Mark A. Sam - 04 Mar 2005 16:42 GMT
Hello Sandra,

I had tried that without success. Ken's method works,

Set frm = Forms(Parse(OpenArgs, 1, ";"))

So I'm set.

God Bless,

Mark

> Try it this way instead  (assuming that PARSE is a userdefined function and
> that it returns a string):
[quoted text clipped - 31 lines]
> >
> > Mark A. Sam
Sandra Daigle - 04 Mar 2005 17:03 GMT
Interesting, what error do you get? Every variation I've tried works. What
is the Parse function returning?

Sub testform()
Dim strForm As String
Dim frm As Form
strForm = "[frm Mouse Over]"
'strForm = "frm Mouse Over"
Set frm = Forms(strForm)
frm.Text0 = "Great!!"

End Sub

Signature

Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

> Hello Sandra,
>
[quoted text clipped - 47 lines]
>>>
>>> Mark A. Sam
Mark A. Sam - 04 Mar 2005 18:14 GMT
Sorry Sandra,   my error.  Your method does work.  I thought I had tried it,
but it must have been a different variation with the brackets.

God Bless,

Mark

> Interesting, what error do you get? Every variation I've tried works. What
> is the Parse function returning?
[quoted text clipped - 60 lines]
> >>>
> >>> Mark A. Sam
Sandra Daigle - 04 Mar 2005 19:32 GMT
Oh good! Glad to know it's not some strange situation I hadn't seen before.

Signature

Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

> Sorry Sandra,   my error.  Your method does work.  I thought I had
> tried it, but it must have been a different variation with the
[quoted text clipped - 72 lines]
>>>>>
>>>>> Mark A. Sam
Mark A. Sam - 04 Mar 2005 20:00 GMT
Sandra,

You will continue to see strange situations that you hadn't seen before,
because Access is evolving on its own....

Its al i i i i i i i i i i i i i ve!!!!

> Oh good! Glad to know it's not some strange situation I hadn't seen before.
>
[quoted text clipped - 74 lines]
> >>>>>
> >>>>> Mark A. Sam
Sandra Daigle - 04 Mar 2005 20:27 GMT
LOL!! It's the truth too!

Signature

Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

> Sandra,
>
[quoted text clipped - 86 lines]
>>>>>>>
>>>>>>> Mark A. Sam
 
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.