Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi All, Fairly new to VB,

Status
Not open for further replies.

TMoney216

Programmer
Mar 1, 2002
11
0
0
US
Hi All,

Fairly new to VB, and I have, what is probably an easy one, a question.

How can I access controls on the main MDI form from a child or document form? When I run the code below I get a runtime error of "Only One MDI Form Allowed", it seems its treating it as another declaration of the form class frmMain.


This occurs when I try to update the main MDIForms status bar, from the Add button on my child form...


Private Sub cmdAdd_Click()
On Error GoTo AddErr


frmMain.sbStatusBar.Panels(2).Text = " Adding an Employee...."


adoPrimaryRS.MoveLast
adoPrimaryRS.AddNew
grdDataGrid.SetFocus

Exit Sub
AddErr:
MsgBox Err.Description
End Sub


Thanks!!!!



 
I think you're on the right track. Every time I have seen that error it was either because I:
(1) Forgot to set the MDIChild property on a child form
or
(2) Created a copy of the main form, ie,
Dim xyz as frmMain

Good luck,
Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top