Solved

Value from another form

Posted on 2003-10-30
15
157 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 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