Code: You cancelled the previous operation!

  • Thread starter Thread starter Alp Bekisoglu
  • Start date Start date
A

Alp Bekisoglu

Hi All,

Can someone help me with regard to why am I getting such an error? The code
is below and is under a cmdbtn on click event.
........
Dim varSerHex, a, c As Variant
Dim bazSer As Variant
bazSer = LTrim(Str(Me!Text2))
If Not IsNull(bazSer) Then
For i = 1 To Len(bazSer)
c = DLookup("char", "Table1", "ascii = Mid(bazSer,i,1)") <<<<< this
is where it gets stuck
varSerHex = varSerHex & c
Next i
Me!Text2hex = varSerHex
End If
..........
Fields in Table1 are: char(Long), ascii(Text), desc(Text), hex(Text) and
Text2 on the form gets a numeric value on load. I have also tried it with
the char field set as Text but the result is same; Run time error 2001!

Thanks in advance,


Alp
 
DLookup() generates this error if it cannot make sense of the Criteria
argument.

Try concatenatating the value into the 3rd string:
c = DLookup("char", "Table1", "ascii = """ & Mid(bazSer,i,1) & """")
 
Back
Top