What went wrong? Run time error 3464

M

Mike

Ok, I asked a few days ago how to do a combo box that would allow you to
type a value in and if it existed in the table (or query) to go to that
record - and if it didn't exist - to create the record. Dave Hargis (Klatuu)
was nice enough to provide the following code for the After Update event.


With Me.RecordsetClone
.FindFirst "[ID] = " & Me.MyCombo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

It worked just great - then. I've then gone through and finished out the
bulk of the DB. I went to show it to someone today and got Run Time error
3464 on the FindFirst "[ID] = " & Me.MyCombo line. The only editing I did to
that line was to change it to fit my database:

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

[Phone] is the field name and LookPhone is my combobox. I'll admit to
messing around with formating in the query and Rowsource line, but i've gone
through and taken out all formats and input masks in phone fields everywhere
and it still is doing the same thing. The [Phone] field in the table is a
text field. The only think I did on the phone field in the table, period,
was change the input mask a couple times and have now even cleared that.
Obviously it looks like it's msimatching numbers and text, but I don't have
anything in that combobox or phone fields anywhere that are formatted to use
numbers - just text. The only thing formatted not as text are date fields
and ID fields.

Why is it all of sudden mismatching?
 
M

Mike

Ok, this one I got...

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

should have been

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

That part works now. The new problem seems to be that whatever I type in the
list doesn't get passed on to the NotInList event becuase if i type a new
number and hit enter. It stays where it is. If i hit enter again, it jumps
to the next record. Argh!! The funny/worst part is, that before fixing the
After Update code, the NotInList code worked. #$%#%^#&#^%# not a way to end
the day :) Is it something similar? Does the NotInList code need to be told
it's a text value somewhere/somehow?

heres the NotInList code

If MsgBox(NewData & " Is Not In The Customer Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
Me.MyCombo = MeMyCombo.OldValue
CurrentDb.Execute ("INSERT INTO Customer Table Table ([ID]) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
With Me.RecordsetClone
.FindFirst "[Activity] = '" & NewData & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Response = acDataErrAdded
Else
Me.MyCombo.Undo
Response = acDataErrContinue
End If
 

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