non-function of cbo 'notinlist'

R

richaluft

Hi;
Second time I'm asking this question, and hope someone can suggest a
cure.
I'm running a form with a cbo box for data entry. I have 5 other
BASICALLY IDENTICAL cbo's on the form, all of which work fine.
My NotOnList event is as follows:

' Add a new policy type by typing a name in
' CoPolicy Type combo box.

Dim NewCoPolicyType As Integer, TruncateName As Integer, Title As
String, MsgDialog As Integer
Const MB_OK = 0
Const MB_YESNO = 4
Const MB_ICONQUESTIONMARK = 32
Const MB_ICONEXCLAMATION = 64
Const MB_DEFBUTTON1 = 0, IDYES = 6, IDNO = 7
' Display message box asking if user wants to add a
' new insurer.
Title = "Policy Type Not In List"
MsgDialog = MB_YESNO + MB_ICONQUESTIONMARK + MB_DEFBUTTON1
NewCoPolicyType = MsgBox("Do you want to add a new Policy Type?",
MsgDialog, Title)

If NewCoPolicyType = IDYES Then

' Open Add Policy form.
DoCmd.OpenForm FormName:="FPolicyTypeCo", DataMode:=acAdd,
WindowMode:=acDialog, openargs:=NewData
' Continue without displaying default error message.
Response = acDataErrAdded

End If
End Sub

When THIS PARTICULAR NotInList event fires, I am find that:
1)the cbo is not cleared of the newdata entry as the dialogue form
opens (as it does on all my other cbo's). Note, however, that the
openargs ARE properly carried to the dialogue form.
2)When the dialogue form is closed, my cbo is blank, and I get errmsg
of "item not in list".

Can anyone make any sense of why this is happening on only one of six
cbos, and any solution you can recommend.
TIA, Richard
 
G

Guest

Just a thought...

Does this combo have the 'limit to list' property set to 'yes' where all the
others are set to 'no'
 
R

richaluft

Just a thought...

Does this combo have the 'limit to list' property set to 'yes' where all the
others are set to 'no'

No, all of cbo's are functionally identical, with 'limit to list' set
to yes.
 
G

Graham Mandeno

Hi Richard

You said in the other thread that:
"the recordsource table for data is also not being updated with new data"

Do you mean that the table on which your combo's RowSource is based is not
getting a new record added with the new policy type?

If so, then the fault is with the form that should be adding that record
(FPolicyTypeCo). If it is not successfully adding a new record to your
RowSource, with a text field exactly matching NewData then you will get the
"item not in list" message.

Just to clarify:
acDataErrContinue means "assume this error has been handled and pass
control back to the user interface (but don't let me leave this combo box if
the error has not been rectified)"
and
acDataErrAdded means "I have added a new row to the data source which
matches what the user entered, so requery it and IF everything is OK then
quit bugging me"
 

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