Parameter from one form to another

M

mike

Hi All,

I created two forms. In one of the forms, I created a
command button and when I click on the command button,
the other form will open. What I'm trying to do is,in the
first form, when I click on the command button, it takes
the parameter from the text box and pass the parameter
tothe other form and the other form display the record
base on the parameter. The code below did work, but it is
not what I wanted to do.

Here is the code:
DoCmd.OpenForm "user", , , "[UserName] = Forms!frmForm1!
lstUserName"

With this method, it pops up with a screen asking me to
type in the user name. Is there any way that I can skip
the pop up screen and directly display the record base on
the parameter passed from the first form? How??

Thanks for the help...

mike
 
A

Albert D. Kallal

Try:

DoCmd.OpenForm "user", , ,
"[UserName] = '" & Forms!frmForm1!lstUserName & "'"

The above goes on one line, but I did not want it wrap in this post...
 
A

Al Camp

Mike,
A polite request...
You asked this question in the access.formscoding NG under "Filter
Argument", and Rick Brandt and Bruce Thompson replied to you.
If there was a problem with the solution they gave you, or if you need
further clarification, then please reply to them on that original thread and
I am sure they (or some one else) will help you further.
When you repost the same question in another group, the "continuity" of
the original problem is lost.

A thread "dying out" does happen... and reposts are necessary from time
to time... but not on the same day as your original post.

** As it were, my own response to your question was in error... and Rick
and Bruce picked up on that. Check out what they had to say.

HTH...
Al Campagna
Candia, NH
 
M

mike

Thanks All for helping.

Al, I need to know the answer quickly so I thought
posting in more that one newsgroup might help. I hope this
help answer why I'm doing reposts.

Mike.
-----Original Message-----
Mike,
A polite request...
You asked this question in the access.formscoding NG under "Filter
Argument", and Rick Brandt and Bruce Thompson replied to you.
If there was a problem with the solution they gave you, or if you need
further clarification, then please reply to them on that original thread and
I am sure they (or some one else) will help you further.
When you repost the same question in another group, the "continuity" of
the original problem is lost.

A thread "dying out" does happen... and reposts are necessary from time
to time... but not on the same day as your original post.

** As it were, my own response to your question was in error... and Rick
and Bruce picked up on that. Check out what they had to say.

HTH...
Al Campagna
Candia, NH

Hi All,

I created two forms. In one of the forms, I created a
command button and when I click on the command button,
the other form will open. What I'm trying to do is,in the
first form, when I click on the command button, it takes
the parameter from the text box and pass the parameter
tothe other form and the other form display the record
base on the parameter. The code below did work, but it is
not what I wanted to do.

Here is the code:
DoCmd.OpenForm "user", , , "[UserName] = Forms!frmForm1!
lstUserName"

With this method, it pops up with a screen asking me to
type in the user name. Is there any way that I can skip
the pop up screen and directly display the record base on
the parameter passed from the first form? How??

Thanks for the help...

mike


.
 
M

mike

I'm still getting the pop up message asking me who to
search for. Is thre a way that I can skip this..

Thanks,

Mike
 
M

mike

It finally works..

Thanks,

mike
-----Original Message-----
I'm still getting the pop up message asking me who to
search for. Is thre a way that I can skip this..

Thanks,

Mike
-----Original Message-----
Try:

DoCmd.OpenForm "user", , ,
"[UserName] = '" & Forms!frmForm1!lstUserName & "'"

The above goes on one line, but I did not want it wrap
in
this post...
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn



.
.
 
R

Ravindra N Shantagiri

Hi,

I read your query. Here is the solution for your problem

DoCmd.OpenForm "user", , , "[UserName] = " & Forms!
frmForm1!lstUserName

Use the above code and see.

Ravi
(e-mail address removed)
 

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