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

Understanding Dlookup function ...

P: n/a
Hello all,
When I use the Dlookup function I get the errormsg "Runtime error 2001 - You
canceled the previous operation" ... Can anybody tell me what I do wrong
here ?
Here is the snippet ... :

DoCmd.GoToRecord , , acNewRec
[Docnummer] = nBriefnum
[Docnummerstr] = sBriefstr
[Datumgemaakt] = Date
Me!txtOreflettersA.Value = DLookup("[Initialen]", "tblMwerkers",
"[Volledigenaam] = sNaamschrijver")

Any help very much appreciated ...
Ronny Sigo
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f*********************@reader2.news.skynet.b e...
Hello all,
When I use the Dlookup function I get the errormsg "Runtime error 2001 - You
canceled the previous operation" ... Can anybody tell me what I do wrong
here ?
Here is the snippet ... :

DoCmd.GoToRecord , , acNewRec
[Docnummer] = nBriefnum
[Docnummerstr] = sBriefstr
[Datumgemaakt] = Date
Me!txtOreflettersA.Value = DLookup("[Initialen]", "tblMwerkers",
"[Volledigenaam] = sNaamschrijver")


If sNaamschrijver is a text variable it needs to be delimited so that the
expression gets the value of the variable passed to it instead of the name of
the variable.

Me!txtOreflettersA.Value = DLookup("[Initialen]", "tblMwerkers",
"[Volledigenaam] = '" & sNaamschrijver & "'")
Nov 12 '05 #2

P: n/a
Thanks Rick ... works perfectly ....

"Rick Brandt" <rv********@sbcglobal.net> wrote in message
news:bl************@ID-98015.news.uni-berlin.de...
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f*********************@reader2.news.skynet.b e...
Hello all,
When I use the Dlookup function I get the errormsg "Runtime error 2001 - You canceled the previous operation" ... Can anybody tell me what I do wrong
here ?
Here is the snippet ... :

DoCmd.GoToRecord , , acNewRec
[Docnummer] = nBriefnum
[Docnummerstr] = sBriefstr
[Datumgemaakt] = Date
Me!txtOreflettersA.Value = DLookup("[Initialen]", "tblMwerkers",
"[Volledigenaam] = sNaamschrijver")
If sNaamschrijver is a text variable it needs to be delimited so that the
expression gets the value of the variable passed to it instead of the name

of the variable.

Me!txtOreflettersA.Value = DLookup("[Initialen]", "tblMwerkers",
"[Volledigenaam] = '" & sNaamschrijver & "'")

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.