Not in List Event

Joshann

Registered User.
Local time
Today, 05:54
Joined
Mar 22, 2002
Messages
142
I can't figure out why this isn't working. I have a form called frmBookItems with a combo box called cmbTitle. The NotInList event looks like this:

Private Sub cmbTitle_NotInList(NewData As String, Response As Integer)
Dim strNewTitle As String

If NewData = "" Then Exit Sub

strNewTitle = NewData

If MsgBox("Title '" & strNewTitle & "' is not in the system. Do you want to add this title?" _
, vbQuestion + vbYesNo, "") = vbYes Then

DoCmd.OpenForm "frmBooks", , , , acFormAdd, acDialog, strNewTitle

If IsNull(DLookup("BookID", "tblBooks", "[Title] = """ & strNewTitle & """")) Then
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If

Exit Sub

End If
Response = acDataErrDisplay
End Sub

It works fine except that when the user comes back to the frmBookItems form from the frmBooks form, frmBookItems has jumped to the next record instead of staying on the record it was on when the NotInList event occurred. Can anyone help with this?
 

Users who are viewing this thread

Back
Top Bottom