Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when using afterupdate to populate

Status
Not open for further replies.

juliesmomma

Technical User
Jun 3, 2002
36
0
0
US
Ok... I have done this several times with other forms but this one particular one is just giving me fits. I want to be able to choose a name from a drop down list and have the department populate for that particular person. This is the code I used.

Me.Dept = DLookup("Department", "Associates", "Associate = [Forms]![Survey Results]![Name]")

I am getting this error message:

"You have canceled this operation".

I can't figure out why I'm getting this. Can someone help???

Thanks!
 
I don't know the answer to your question.

See, however, thread702-585184 because the problems sound similar.

"The potentialities of a language are so vast that we must wonder sometimes at ourselves: how do we manage to know so much?" Anthony Burgess, A Mouthful of Air
 
More often than not (in my experience) that particular error means you didn't get the syntax of a SQL or in your case DLookup statement quite right.

In this case, try the following:


Me.Dept = DLookup("[Department]", "Associates", "[Associate] = '" & [Forms]![Survey Results]![Name] & "'")

The brackets around the field name ("[Department]" are required, and you have to concatenate the value from the [Name] field on the [Survey Results] form.

If it was a number in that field, then you'd simply omit the single quote I've added on either side of the form!field reference.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top