dbTalk Databases Forums  

Reference object

comp.databases.ms-access comp.databases.ms-access


Discuss Reference object in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
 
Posts: n/a

Default Reference object - 04-03-2011 , 05:28 AM






In a subform I have this query:
strSQL = "Delete ID_hyperlink FROM tbHyperlink " & _
"WHERE (((ID_hyperlink)=" &
[Forms]![frmRequest]![subfrmHypLink].[Form]![ID_hyperlink] & "));"

Now I want to change the code so I can use it for another main form as well
like frmArticle:
[Forms]![frmArticle]![subfrmHypLink].[Form]![ID_hyperlink]

Unfortunately Parent.Name doesn't work in this case:
[Forms]!Parent.Name![subfrmHypLink].[Form]![ID_hyperlink]

Is there a way to easily refer to the right main form in the above code?

Thanks,
Martin

Reply With Quote
  #2  
Old   
Bob Quintal
 
Posts: n/a

Default Re: Reference object - 04-03-2011 , 06:15 AM






<martin (AT) hotmail (DOT) com> wrote in
news:62649$4d984bea$5356be6c$21611 (AT) cache110 (DOT) multikabel.net:

Quote:
In a subform I have this query:
strSQL = "Delete ID_hyperlink FROM tbHyperlink " & _
"WHERE (((ID_hyperlink)=" &
[Forms]![frmRequest]![subfrmHypLink].[Form]![ID_hyperlink] & "));"

Now I want to change the code so I can use it for another main
form as well like frmArticle:
[Forms]![frmArticle]![subfrmHypLink].[Form]![ID_hyperlink]

Unfortunately Parent.Name doesn't work in this case:
[Forms]!Parent.Name![subfrmHypLink].[Form]![ID_hyperlink]

Is there a way to easily refer to the right main form in the above
code?

Thanks,
Martin


Me.Parent.Name![subfrmHypLink].[Form]![ID_hyperlink]



--
Bob Q.
PA is y I've altered my address.

Reply With Quote
  #3  
Old   
Douglas J Steele
 
Posts: n/a

Default Re: Reference object - 04-03-2011 , 07:41 AM



As it implies, Parent.Name returns the name of the object: you want the
object itself.

Use

Me.Parent![subfrmHypLink].[Form]![ID_hyperlink]

wrote in message
news:62649$4d984bea$5356be6c$21611 (AT) cache110 (DOT) multikabel.net...

In a subform I have this query:
strSQL = "Delete ID_hyperlink FROM tbHyperlink " & _
"WHERE (((ID_hyperlink)=" &
[Forms]![frmRequest]![subfrmHypLink].[Form]![ID_hyperlink] & "));"

Now I want to change the code so I can use it for another main form as well
like frmArticle:
[Forms]![frmArticle]![subfrmHypLink].[Form]![ID_hyperlink]

Unfortunately Parent.Name doesn't work in this case:
[Forms]!Parent.Name![subfrmHypLink].[Form]![ID_hyperlink]

Is there a way to easily refer to the right main form in the above code?

Thanks,
Martin

Reply With Quote
  #4  
Old   
 
Posts: n/a

Default Re: Reference object - 04-03-2011 , 08:44 AM



Thanks. I got it working.

Martin


"Douglas J Steele" schreef in bericht news:in9ptj$lq$1 (AT) dont-email (DOT) me...

As it implies, Parent.Name returns the name of the object: you want the
object itself.

Use

Me.Parent![subfrmHypLink].[Form]![ID_hyperlink]

wrote in message
news:62649$4d984bea$5356be6c$21611 (AT) cache110 (DOT) multikabel.net...

In a subform I have this query:
strSQL = "Delete ID_hyperlink FROM tbHyperlink " & _
"WHERE (((ID_hyperlink)=" &
[Forms]![frmRequest]![subfrmHypLink].[Form]![ID_hyperlink] & "));"

Now I want to change the code so I can use it for another main form as well
like frmArticle:
[Forms]![frmArticle]![subfrmHypLink].[Form]![ID_hyperlink]

Unfortunately Parent.Name doesn't work in this case:
[Forms]!Parent.Name![subfrmHypLink].[Form]![ID_hyperlink]

Is there a way to easily refer to the right main form in the above code?

Thanks,
Martin

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.