How can I write the following with the correct name of the childform that is open.
VB Code:
If "Open Childform Name" = cForm1 then ...
Printable View
How can I write the following with the correct name of the childform that is open.
VB Code:
If "Open Childform Name" = cForm1 then ...
Use the MDIForm's ActiveForm Property, i.e.VB Code:
If MDIForm1.ActiveForm.Name = "Form1" Then ... End If
Thanks Aaron,
I am now getting the error
Object variable or with block variable not set.
This is my line of code
Where NewDate is a global variable.VB Code:
If MDIMain.ActiveForm.Name = "frmGradingCalc" Then cmbCourseList.Text = NewDate
Where have you placed this line of code?Quote:
Originally posted by aikidokid
Thanks Aaron,
I am now getting the error
Object variable or with block variable not set.
This is my line of code
Where NewDate is a global variable.VB Code:
If MDIMain.ActiveForm.Name = "frmGradingCalc" Then cmbCourseList.Text = NewDate
You will get this error if there are no active child forms, i.e. the form does not exist (object variable not set)
Try this . . .
VB Code:
If MDIMain.ActiveForm Is Nothing Then 'no child form loaded 'put whatever code you need here ElseIf MDIMain.ActiveForm.Name = "frmGradingCalc" Then cmbCourseList.Text = NewDate End If