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

Error with DLookUp

P: n/a
Hi all, i am running into problems with a DLookUp below:
=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " &
me!LastName)

This is in the Control Source of a text box on the same form.

"LastName" is a text box on the form, but i get an error message

("The object doesn't contain the Automation object 'me.') and then
("You tried to run a visual basic procedure to set a property or method
for
an object. However, the component doesn'y make the property or method
available for Automation operations")

As a newbie i am totally stumped, please heeeeeelp somebody
Tempy

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


P: n/a
Tempy wrote:
Hi all, i am running into problems with a DLookUp below:
=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " &
me!LastName)


You're missing a closing quote and in a Control expression you can't use
"Me" (nor do you need it).

=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] = '" & [LastName] &
"'")

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

P: n/a
Thanks rick this solved my problem.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

P: n/a
On Wed, 08 Jun 2005 14:21:07 GMT, Tempy <an*******@devdex.com> wrote:
Hi all, i am running into problems with a DLookUp below:
=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " &
me!LastName)

This is in the Control Source of a text box on the same form.

"LastName" is a text box on the form, but i get an error message

("The object doesn't contain the Automation object 'me.') and then
("You tried to run a visual basic procedure to set a property or method
for
an object. However, the component doesn'y make the property or method
available for Automation operations")

As a newbie i am totally stumped, please heeeeeelp somebody
Tempy

*** Sent via Developersdex http://www.developersdex.com ***


Looks like a syntax problem. You need a closing single quote after
me!LastName:

DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' "
&me!LastName & " ' ")

Where single- and double-quotes are adjacent, remove the spaces
between them. I showed them only for illustrative purposes.

Frankly, I don't think you should be dealing with names at all for
such a query, since two separate buyers could theoretically have the
same last name. You're better off to have a buyer table with each
buyer uniquely identified with an auto-generated ID. The criteria for
your query would then be "BuyerID=" & me.BuyerID.

One other piece of advice, you probably want to do yourself a favour
and not use field names with spaces. Change [Project Parts] to
ProjectParts. This will eliminate the annoying need for square
brackets all the time.

Chuck
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.