Error msg when using me.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

"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
 
The Me. Keyword will only work in the form's own module, not in a
general module. Any chance the code is in a general module? If yes, then
you need to reference the form explicitly, like:

=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " _
& Forms("YourFormNameHere").LastName)

HTH,
Nikos
 
Hi Nikos, The DLookUp is in the Control Source of a text box on the same form.
I changed it to =DLookUp("[Project Parts]","tblBuyerTotals","ByrName = '"
& Forms("frmByrDetails").LastName)

Now i get the error ( Syntax error in string in query 'ByrName = 'Baden' )

this tells me it is seeing the name, but there is an error i have tried
changing apostrophies with no luck ?

--
Les


Nikos Yannacopoulos said:
The Me. Keyword will only work in the form's own module, not in a
general module. Any chance the code is in a general module? If yes, then
you need to reference the form explicitly, like:

=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " _
& Forms("YourFormNameHere").LastName)

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

"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
 
Hi All, i solved this problem with the following:

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

This works 100%

--
Les


Newbie said:
Hi Nikos, The DLookUp is in the Control Source of a text box on the same form.
I changed it to =DLookUp("[Project Parts]","tblBuyerTotals","ByrName = '"
& Forms("frmByrDetails").LastName)

Now i get the error ( Syntax error in string in query 'ByrName = 'Baden' )

this tells me it is seeing the name, but there is an error i have tried
changing apostrophies with no luck ?

--
Les


Nikos Yannacopoulos said:
The Me. Keyword will only work in the form's own module, not in a
general module. Any chance the code is in a general module? If yes, then
you need to reference the form explicitly, like:

=DLookUp("[Project Parts]","tblBuyerTotals","[ByrName] =' " _
& Forms("YourFormNameHere").LastName)

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

"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
 
Back
Top