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
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