' *******************************
Private Sub cboCustomer_NotInList( _
NewData As String, Response As Integer)
Dim strMsg As String
strMsg = NewData _
& " が得意先テーブルに存在しません!" _
& vbCrLf & "登録しますか?"
If MsgBox(strMsg, vbYesNo + vbQuestion, "得意先") = vbYes Then
DoCmd.OpenForm "frmCustomer2", _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("frmCustomer2") Then
Response = acDataErrAdded
DoCmd.Close acForm, "frmCustomer2"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
' *****************************************
Private Function IsLoaded(strName As String) _
As Boolean
IsLoaded = (SysCmd(acSysCmdGetObjectState, acForm, strName) <> 0)
End Function