Value from another form

In my first form (start.frm) there is a value FindStr. Can I use this value in anthoter form warning.frm?

In start.frm there is set a value FindStr.
If something is found, it opens warning.frm
How to show the value  FindStr from start.frm in warning.frm?

Jeffeny
harryvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clanglCommented:
If you create a Property in warning.frm and then warning.frm.FindStr=start.frm.FindStr may give you a quck solution.
0
harryvAuthor Commented:
Hoi,

It gives an error on Start.frm.FindStr

Private Sub Form_Load()
Dim FindStr As String
Warning.frm.FindStr = Start.frm.FindStr
MsgBox "WARNING: " & FindStr, vbCritical
End Sub

What's wrong?
0
vinnyd79Commented:
Add a bas module and define FindStr as public:

' in a bas module
Public FindStr as string
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rajaamirapuCommented:
If start is the name of the form
Use Start.FindStr
0
dbrckoviCommented:
Yes you can but you have to declare this value as property,   like this:      Public FindStr As String

Now it can be accessed from any form like:       Start.FindStr          and you can use this as any other variable.


P.S.    You dont have to write a form extension becouse it can make people confused.  Just saying that this is a form should be enough.
         
0
vinnyd79Commented:
Yes,but if you put "Public FindStr as string" in a bas module,then you can use FindStr on any form without specifying a form name in front.
0
clanglCommented:
If you are using VB 6 you need to define the Property
dim mFindStr as String
Public Property Get FindStr () as string
   FindStr =mFindStr
end Property
Public Property Let FindStr (newVal as string)
  mFindStr=newVal
end Property
0
clanglCommented:
These Properties need to be defined in the Form
0
harryvAuthor Commented:
Ok I have created a module1 (module1.bas) with the text

Public FindStr As String

But:

Private Sub Form_Load()
MsgBox "WARNING: " & Start.FindStr, vbCritical
End Sub

Gives an error on Findstr

Do I have to include the module?

?
0
rajaamirapuCommented:
remove start
0
vinnyd79Commented:
If you put it in a module,then just use this on your form:

Private Sub Form_Load()
MsgBox "WARNING: " & FindStr, vbCritical
End Sub

0
rajaamirapuCommented:
directly reference Findstr
0
harryvAuthor Commented:
No value
0
vinnyd79Commented:
Make sure you are setting the value of FindStr on your start form.Also make sure you are not dimming FindStr on your forms because it will override the Public declaration in the module.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
harryvAuthor Commented:
Yes!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.