Solved

Can't change the properties of a MDI form

Posted on 1998-10-08
7
190 Views
Last Modified: 2010-04-30
I have a program that uses a MDI form. I try to change that forms properties just like any other object like
formname.proprety.value or for a better example
form1.caption = "Test"
I get a run time error 426; Only one MDI form allowed.
What should I do? Thanks
0
Comment
Question by:xer_soft
[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
7 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1438928
Error 426 - Only one MDI Form allowed

A project can only have one MDIForm. This error has the following causes and solutions:

You tried to load a file containing an MDIForm into a project that already has an MDIForm in it. Remove the file containing the loaded MDIForm before loading another.

You tried to load a second instance of an MDIForm created with a Dim or Set statement. You can only create one instance of an MDIForm in a project.

0
 
LVL 1

Expert Comment

by:CarlosJac
ID: 1438929
If you has generated the app with Application Wizard:

use fMainForm and not use the mdiform name.
Example:

fMainForm.caption = "Test"


Why?

The app wizard has created a module with sub main:

Sub Main()
    Set fMainForm = New frmMain
    fMainForm.Show
End Sub

If you attempt use frmMain, VB attempt to load the mdiform , but the mdi is already loade.

Good Luck

Sorry, my english is very bad.

0
 
LVL 2

Expert Comment

by:mkmccreary
ID: 1438930
The problem is the way you are referring to the form.  I would have to look at the code to tell you exactly what is going on.  Here is a workaround, though.  It uses the Forms Collection to change the caption:

Dim i as Integer

For i = 0 To Forms.Count
    If Forms(i).Name = "MDIForm1" Then
        Forms(i).Caption = "Test"
        Exit For
    End If
Next i

Just change the name in quotes to the name of your MDI form.

Later,
Martin

0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 1

Author Comment

by:xer_soft
ID: 1438931
CarlosJac please put you answer down as the answer for as you have helped me the most. Thanks much your way worked great and was very easy. Your english was not that bad! Thanks again!
0
 
LVL 1

Accepted Solution

by:
CarlosJac earned 200 total points
ID: 1438932
If you has generated the app with Application Wizard:

use fMainForm and not use the mdiform name.
Example:

fMainForm.caption = "Test"


Why?

The app wizard has created a module with sub main:

Sub Main()
    Set fMainForm = New frmMain
    fMainForm.Show
End Sub

If you attempt use frmMain, VB attempt to load the mdiform , but the mdi is already loade.

Good Luck

Sorry, my english is very bad.

0
 
LVL 1

Author Comment

by:xer_soft
ID: 1438933
Thanks a bunch!!!!!!!
0
 
LVL 1

Expert Comment

by:CarlosJac
ID: 1438934
not at all
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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

734 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