Form loaded

  • Thread starter Thread starter GR
  • Start date Start date
G

GR

Hi,
I am using the not in list event to add a new item to a
combo box. but the IsLoaded is giving me lot of problems..
is there any other way to know if a form is loaded or not?
here is the code:

Private Sub ProjectName_NotInList(NewData As String,
Response As Integer)
Dim obj as Object
If MsgBox("Sub-Project not found, add?", vbYesNo +
vbQuestion, _
"Please Respond") = vbYes Then
DoCmd.OpenForm "frmSubProjects", _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
Set obj = Forms!frmSubProjects

'here is the problem
If obj.IsLoaded = True Then


Response = acDataErrAdded
DoCmd.Close acForm, "frmSubProjects",
acSaveYes
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub

thx,
gr
 
Subforms do not become part of the Forms collection, i.e. they are not
loaded in their own right.

Test if the main form is loaded. You can use the AllForms collection in
Access 2002 or 2003. In earlier versions, copy the IsLoaded() function from
the Northwind sample database.
 
Back
Top