?
Solved

Value from another form

Posted on 2003-10-30
15
Medium Priority
?
159 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:harryv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +2
15 Comments
 

Expert Comment

by:clangl
ID: 9649662
If you create a Property in warning.frm and then warning.frm.FindStr=start.frm.FindStr may give you a quck solution.
0
 

Author Comment

by:harryv
ID: 9649746
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
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9649771
Add a bas module and define FindStr as public:

' in a bas module
Public FindStr as string
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Expert Comment

by:rajaamirapu
ID: 9649786
If start is the name of the form
Use Start.FindStr
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9649807
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
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9649842
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
 

Expert Comment

by:clangl
ID: 9649917
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
 

Expert Comment

by:clangl
ID: 9649925
These Properties need to be defined in the Form
0
 

Author Comment

by:harryv
ID: 9649939
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
 
LVL 5

Expert Comment

by:rajaamirapu
ID: 9649953
remove start
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9649954
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
 
LVL 5

Expert Comment

by:rajaamirapu
ID: 9649964
directly reference Findstr
0
 

Author Comment

by:harryv
ID: 9649974
No value
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 100 total points
ID: 9650000
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
 

Author Comment

by:harryv
ID: 9650044
Yes!!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question