By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

DLookUp Error message

P: n/a
Good day,
I have put the below into Module1 and get an error message "Run-Time
error '2001'"
"You canceled the previous operation". Can anybody tell me what is wrong
?

Sub test()
Dim varX As Variant
varX = DLookup("[LastName]", "tblQualityStaff", "[EmployeeID] = 1")
MsgBox varX
End Sub
--
Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Tempy <an*******@devdex.com> wrote:
: Good day,
: I have put the below into Module1 and get an error message "Run-Time
: error '2001'"
: "You canceled the previous operation". Can anybody tell me what is wrong
: ?

: Sub test()
: Dim varX As Variant
: varX = DLookup("[LastName]", "tblQualityStaff", "[EmployeeID] = 1")
: MsgBox varX
: End Sub

I've had this message. It seems to happen when the criteria
parameter has a data-type conflict with the table/query field.

Perhaps try

Dim EmpIDWanted as ...whatever [EmployeeID] field is specified as...
EmpIDWanted = 1
varX = DLookup("[LastName]", "tblQualityStaff", _
"[EmployeeID] = " & EmpIDWanted

--thelma [too new to really know]
:
: Tempy
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.