NotinList not getting called?

M

Mike

I have this code (graciously provided by Dave Hargis)

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

If MsgBox(NewData & " Is not in the database " & vbNewLine _
& "Do you want to Create a new record?", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
Me.LookPhone = Me.LookPhone.OldValue
CurrentDb.Execute ("INSERT INTO Customers ([Phone]) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
With Me.RecordsetClone
.FindFirst "[Phone] = '" & NewData & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Response = acDataErrAdded
Else
Me.LookPhone.Undo
Response = acDataErrContinue
End If


End Sub

Late monday, it, along with it's AfterUpdate counterpart was working just
fine. Now all of sudden both events stopped working. In the after update
event I changed the line

..FindFirst "[Phone] = """ & Me.LookPhone & """"

To where it was looking for a string and that event started working again.
Now the NotInList isn't fuctioning. I type in a non-existant value and it
just does nothing. Hitting enter again, simply moves to the next existing
record. I didn't change anything in the table this form is accessing. I just
finished building the rest of the db for the most part. The fact it was
working is driving me nuts. Can someone explain what's going wrong here?
please? :)

Thanks
Mike
 
M

Mike

Ack! That was it. Thank you for pointing it out. I feel kinda dumb for
missing that :) I think i'm too involved in the project. I need to take a
step back maybe.

I'm new at Access programming and probably just know enough to be dangerous.
How that got changed - I don't know but somehow it changed. Probably an
inadvertant click in my extremely long journey in trying to format the text
in the list box itself.

Thank you again!
Mike


Douglas J. Steele said:
Might the LimitToList property somehow been changed to False?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Mike said:
I have this code (graciously provided by Dave Hargis)

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

If MsgBox(NewData & " Is not in the database " & vbNewLine _
& "Do you want to Create a new record?", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
Me.LookPhone = Me.LookPhone.OldValue
CurrentDb.Execute ("INSERT INTO Customers ([Phone]) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
With Me.RecordsetClone
.FindFirst "[Phone] = '" & NewData & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Response = acDataErrAdded
Else
Me.LookPhone.Undo
Response = acDataErrContinue
End If


End Sub

Late monday, it, along with it's AfterUpdate counterpart was working just
fine. Now all of sudden both events stopped working. In the after update
event I changed the line

.FindFirst "[Phone] = """ & Me.LookPhone & """"

To where it was looking for a string and that event started working
again. Now the NotInList isn't fuctioning. I type in a non-existant value
and it just does nothing. Hitting enter again, simply moves to the next
existing record. I didn't change anything in the table this form is
accessing. I just finished building the rest of the db for the most part.
The fact it was working is driving me nuts. Can someone explain what's
going wrong here? please? :)

Thanks
Mike
 
?

.

dans l'article (e-mail address removed), Mike à
(e-mail address removed) a écrit le 23/01/08 19:18 :
 

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