Solved

Value from another form

Posted on 2003-10-30
15
152 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now