Solved

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

Posted on 2001-06-27
5
135 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
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 49

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

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 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

22 Experts available now in Live!

Get 1:1 Help Now