Since you are adding the record using a different form, you current form
doesn't know about it yet. You should requery your form in the Not In List
event after the record has been added in the add record form. Then rather
than a DLookup, use the FindFirst method on the form's recordsetclone to
navigate to the newly added record. Here is a modification of your current
code:
Private Sub Combo14_NotInList(NewData As String, Response As Integer)
Dim Msg As String
If NewData = "" Then
Exit Sub
End If
If MsgBox(NewData & "' is not in the list." & vbNewLine & vbNewLine & _
"Do you want to add it?", vbQuestion + vbYesNo) = vbYes Then
DoCmd.OpenForm "newpart", , , , acAdd, acDialog, NewData
Me.Combo14.Undo
DoCmd.OpenForm "newpart", , , , acAdd, acDialog, NewData
Response = acDataErrAdded
Me.Requery
With Me.RecordsetClone
.FindFirst "[ProductID] = """ & NewData & """"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Else
Me.Combo14.Undo
Response = acDataErrContinue
End If
End Sub
Notice I used the constants vbQuestion, vbYesNo, etc rather than their
values. It makes the code much easier to read. Also, no need to Dim a
variable for a line feed. there are at least two different intrinsic
constants that do that. I prefer vbNewLine, because its purpose is obvious
to the reader.

Signature
Dave Hargis, Microsoft Access MVP
> I am using a second form to enter new data, when I return back to the main
> form I can only auto fill the productID detail, all the other data entered in
[quoted text clipped - 32 lines]
>
> End Sub
gymphil - 24 Jun 2008 10:04 GMT
Dave,
Many thanks for that, I have changed the code and it works great. I would
have liked to use the same form to create new records but got into all sorts
of bother when using me.combo14 = me.productID on the forms on current event.
Thanks again Dave
Phil
> Since you are adding the record using a different form, you current form
> doesn't know about it yet. You should requery your form in the Not In List
[quoted text clipped - 72 lines]
> >
> > End Sub
Klatuu - 24 Jun 2008 15:42 GMT
Why do you need to do that?
Combo14 is not a bound control, is it?

Signature
Dave Hargis, Microsoft Access MVP
> Dave,
>
[quoted text clipped - 82 lines]
> > >
> > > End Sub
gymphil - 26 Jun 2008 16:22 GMT
Dave,
No that's correct, combo14 is not bound, that was partly the problem. When
scrolling through the records on the form, the contents of the combobox
didn't change, this was misleading and the advice provided was to use
me.combo14 = me.productID, this kept the combobox in sync with the record
that appeared on the screen. But for some reason this created a conflict when
I tried to use the same form to add records.
Phil
> Why do you need to do that?
> Combo14 is not a bound control, is it?
[quoted text clipped - 85 lines]
> > > >
> > > > End Sub
Klatuu - 26 Jun 2008 16:25 GMT
Okay, that makes sense. My preference is to set it to Null so nothing shows
in it:
me.combo14 = Null

Signature
Dave Hargis, Microsoft Access MVP
> Dave,
>
[quoted text clipped - 96 lines]
> > > > >
> > > > > End Sub
gymphil - 27 Jun 2008 09:40 GMT
I have got to keep the contents of the combo box visible otherwise I will not
know what record the fields on the form relate to!
Phil
> Okay, that makes sense. My preference is to set it to Null so nothing shows
> in it:
[quoted text clipped - 100 lines]
> > > > > >
> > > > > > End Sub
Klatuu - 27 Jun 2008 14:52 GMT
Use a bound text box to show the value rather than the combo. To reduce
confusion, I use a bound text box and put my unbound search combo in the form
header.

Signature
Dave Hargis, Microsoft Access MVP
> I have got to keep the contents of the combo box visible otherwise I will not
> know what record the fields on the form relate to!
[quoted text clipped - 105 lines]
> > > > > > >
> > > > > > > End Sub
gymphil - 30 Jun 2008 10:41 GMT
Dave,
I hadn't thought of doing it that way.
I would much rather use the same form for entering new records but could you
please tell me what changes I would need to make to the coding, I know I do
not need to open the new form but not sure about the rest of it.
Many thanks
Phil
> Use a bound text box to show the value rather than the combo. To reduce
> confusion, I use a bound text box and put my unbound search combo in the form
[quoted text clipped - 109 lines]
> > > > > > > >
> > > > > > > > End Sub
Klatuu - 30 Jun 2008 14:44 GMT
Just use the After Update event of the comb box to load the selected value
into the text box.

Signature
Dave Hargis, Microsoft Access MVP
> Dave,
>
[quoted text clipped - 121 lines]
> > > > > > > > >
> > > > > > > > > End Sub