Setting form Variable

M

Mark A. Sam

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
 
K

Ken Ismert

Try:

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

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

-Ken
 
S

Sandra Daigle

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)
 
M

Mark A. Sam

Thanks Ken,

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

God Bless,

Mark
 
M

Mark A. Sam

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


Sandra Daigle said:
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)



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

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
 
S

Sandra Daigle

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



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

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


Sandra Daigle said:
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)



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

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
 
M

Marshall Barton

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.
 
M

Mark A. Sam

Marshall, positive.. the form name is passed to openargs. I verify it in
the immediate window.

?strForm



Marshall Barton said:
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.
--
Marsh
MVP [MS Access]


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


"Ken Ismert" wrote
 
M

Mark A. Sam

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



Sandra Daigle said:
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



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

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


Sandra Daigle said:
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)



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


Mark A. Sam wrote:
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
 
S

Sandra Daigle

Oh good! Glad to know it's not some strange situation I hadn't seen before.

--
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
brackets.

God Bless,

Mark



Sandra Daigle said:
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



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

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):

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



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


Mark A. Sam wrote:
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
 
M

Mark A. Sam

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!!!!


Sandra Daigle said:
Oh good! Glad to know it's not some strange situation I hadn't seen before.

--
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
brackets.

God Bless,

Mark



Sandra Daigle said:
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



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


Mark A. Sam wrote:
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):

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



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


Mark A. Sam wrote:
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
 
S

Sandra Daigle

LOL!! It's the truth too!

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

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!!!!


Sandra Daigle said:
Oh good! Glad to know it's not some strange situation I hadn't seen
before.

--
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
brackets.

God Bless,

Mark



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



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


Mark A. Sam wrote:
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):

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



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


Mark A. Sam wrote:
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
 
M

Marshall Barton

It was just a thought.

Good thing you have something that works.
--
Marsh
MVP [MS Access]


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?

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

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


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top