Code: You cancelled the previous operation!

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
 
A

Allen Browne

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) & """")
 

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