not in list access error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code to call a form to input data when it is not already in the table
underneath and appearing in the combo box. I have an intermittent problem of
the code runs and opens the form to input the new details but also sometimes
the default microsoft access error dialogue box appears for value not in
list. How do I stop this happening?
 
What does your code look like? Are you remembering to set Response =
acDataErrAdded?
 
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "NotInList.mdb" which does this. Perhaps if you compared my
application to yours, you'll see a difference. Also, there is one called
"NotInListAlternative.mdb" which does not rely on the Not In List event.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Douglas below is the code for the notinevent for the combo box, the combo box
is in a subform on the main form. the subform record source is a table and
the combo box record souirce is a query.

Dim Msg, Style, Title ' Declare
Variables

Msg = "Do you wish to add a new Individual Name?" ' Define
message.

Style = vbYesNo + vbCritical + vbDefaultButton1 ' Define
buttons.

Title = "Individual Name" ' Define
title.

Response = MsgBox(Msg, Style, Title) ' Display
Message

If Response = vbYes Then
DoCmd.OpenForm "frm_individual_name_new", , , , acFormAdd, acDialog,
NewData
Response = acDataErrAdded 'combo
automatically requeried
Else
Response = acDataErrContinue
Me.Undo
End If
 
Try putting a Requery of your combobox after you return from the call to the
form.
 
Back
Top