Not in List

C

Chris

hello group. When an item is not in the combobox I would like a form to
open so that I can add extra details. On closing the extra details form I
would like the combobox to = the value that was entered. This can only be
done by requerying the combobox but I can't seem to make it work.

Public Function IsLoaded(strName As String, _
Optional lngType As AcObjectType = acForm) As Boolean
IsLoaded = (SysCmd(acSysCmdGetObjectState, _
lngType, strName) <> 0)
End Function

Private Sub cboCreditor_NotInList(NewData As String, Response As Integer)

Dim mbrResponse As VbMsgBoxResult
Dim strMsg As String

strMsg = "'" & NewData & _
"' is not in the list." & _
"Add a new creditor?"
mbrResponse = MsgBox(strMsg, vbYesNo + vbQuestion, "Invalid Creditor")
Select Case mbrResponse
Case vbYes
DoCmd.OpenForm "frmCreditorName", _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData


'Stops and waits here untill the form goes away
If IsLoaded("frmCreditorName") Then
Response = acDataErrAdded
DoCmd.Close acForm, "frmCreditorName"
Else:
Response = acDataErrContinue
End If
Case vbNo
Response = acDataErrContinue
End Select
 

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

Top