Link to home
Start Free TrialLog in
Avatar of durick
durickFlag for United States of America

asked on

dlookup function gives error, you cancelled the previous opertation

have a simple database of state names and 2char
 codes  

state is a text string          
   state = LTrim(Mid(address, (newpos1 + 1), newpos2 - newpos1))
                 Me.ManagerState = state ' post state
'now I want to get the  2 character code
                 stcode = DLookup("code", "tblstatecodes", "name = " & state)
                  Me.ManagerState = stcode ' post 2char code

problem is 1. does not work, dlookup gives error you cancelled the previous opertation


the problem is in the crtiteria statement
states.mdb
Avatar of jerryb30
jerryb30
Flag of United States of America image

stcode = DLookup("code", "tblstatecodes", "name = '" & state & "'")
Assuming [state] and [name] are text fields
SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
...yeah, I hate that cryptic error though...
:-O
durick,

You had two different people helping you here, and we had very similar comments.  The points wound up split between two of my comments, with me getting all of the points.  Did you intend to divide the points between me and Jerry?