Solved

how could i access a form created using instance by code?

Posted on 2001-06-27
5
138 Views
Last Modified: 2010-05-02
I have created an mdiform containing a new menu.in this i create an instance of another form which contains a text box.every time i click i get a new instance of the form. i save the text in the text box using Activeform property in a random file.say i have 4 instances of the same form if i quit the app i rise a question to save the text in a file.i could only save the active form's text for no of times the instance of the form is created.how could i access the remaining 3 forms and save it?
0
Comment
Question by:GaneshDevx
[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
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 75 total points
ID: 6231275
If you use the Forms collection you can do this:

On Error Resume Next
Open "MyFile" For Output As #1
For Each MyForm In Forms
  Print MyForm.Text1.Text
Next

This is just the simplest version, you should add some additional verification in case you have other forms which do not have the same control. In this way you would also write the value for the activeform so you could do away with that part of your code.
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6231295
Hi,

When quit the program:

Do while <ActiveForm is not nothing>
   <Save value to your file>
   <Close the current form>
loop
0
 
LVL 1

Expert Comment

by:HelixDaKat
ID: 6232102
In the form tht has the textbox add a Property that indicates that the contents of the box have changed.

In the unload event of the form add code to prompt the user to save the modified information.

This way you will always get a prompt when ever the user changes anything on anyform.

So if the user changes the values of windows 1,2, & 4. The user will be prompt 3 times to save the information.

HDK
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7139894
Hi GaneshDevx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept TimCottee's comment(s) as an answer.

GaneshDevx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7178851
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 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…
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…

726 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