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