Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace Me keyword with specific object or form name 1

Status
Not open for further replies.

b31luv

Technical User
Feb 21, 2002
171
US
How can this be done? I have a function that I took from a class module and put in a standard module and I keep getting the "Invalid use of Me keyword" error. The help screens says to "replace the Me keyword with the specifc object or form name to preserve the original reference."

Code:
stLinkCriteria = "[SiteNameID]=" & "'" & [b]Me[/b]![SiteNameID] & "'
stLinkCriteria = stLinkCriteria & " And [AreaCode]='" & [b]Me[/b]![AreaCode] & "'"

Everything I try gives me a new error.

Invalid outside procedure
Object required

Any suggestions?
 
[tt]forms!frmNameOfYourForm!SiteNameID[/tt]

- the form must be open, too

Roy-Vidar
 
Thanks RoyVidar.

Code:
Forms.frmProjectInfo.AreaCode = Forms![frmProjectArea Subform]!AreaCode

I have this issue here. I need to get this out of my subform. The error message keeps saying database can't find it. I wrote it this way also

Code:
Forms.frmProjectInfo.AreaCode = Forms.[frmProjectArea Subform].AreaCode
 
I got it. I just put the second part of the code someplace else and required the user to save the selection first.
 
To use the "construction" in more nearly its' original (and -to me simpler- form) send the form to the function as an argument and replace "me" with the argument.

Of course, this restricts the use of the procedure to forms, but aparently that is already an expectation.



MichaelRed


 
Also this will not work

Forms.frmProjectInfo.AreaCode = Forms.[frmProjectArea Subform].AreaCode

When you reference an object in a collection either use the Bang or Parentheses notation

Forms!frmProjectInfo
or
Forms("frmProjectInfo")
not
Forms.frmProjectInfo

To reference a control on a subform

Forms!(formName).subFormControlName.form.controlName
or
Forms("formName).subFormControlName.form.form.controlName
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top