Form loaded

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
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top