Auto fill

  • Thread starter Thread starter Phantom_guitarist
  • Start date Start date
P

Phantom_guitarist

I'm working on a function to auto fill as a user types in a text box by
comparing it to previous data in that field.

The start of the code is

Dim search As String, found As Variant, search2 As String
search2 = [tofrom].text
If search2 <> "" Then
MsgBox CStr(Len(search2))
found = DLookup("[To/From]", "qryToFrom_Sorted",
"left([To/From],len(search2)) = '" & search2 & "'")
If found <> "" Then
MsgBox found, vbInformation
End If
End If

This basically takes what the user is typing in ( variable search2 ) and
does a lookup on the what has previously been entered in the table (it's
using a query so that newer data is checked first).

The piece of code

"left([To/From],len(search2)) = '" & search2 & "'"

basically takes what has been entered and compares it with what is in the
database (but reduces database items to the same length as search2)


But every time it runs it comes up with the error message "You canceled the
previous operation." there's no reference in the help file for this.
I can't figure out why it is doing this.

any ideas

Stef
 
Wouldn't it be a heck of a lot easier (not to mention
efficient) to use a drop down combo and enable the auto
complete? ?? ??? ????
 
Back
Top