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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Custom Command Button Code

Status
Not open for further replies.

joel2fam

Technical User
Oct 18, 2011
1
US
hello,

i've used the code found in the faq702-5307 for creating custom command buttons on access forms with great success. the problem i'm having with it now is that it doesn't work when the custom button is on the subform of the main form. when i click on the custom button, it comes up with an error:

"Microsoft Office Access can't find the form 'SubformName' referred to in a macro..."

when i debug, it takes me to the portion of the code that begins:

Forms(strForm).Controls(cmdButton & "_Hover").Visible = True

i think the problem is in the reference to the form (where strForm = SubformName), but i don't know how to rewrite the code so that all custom buttons work in my database, regardless of whether they're on the main or sub forms.

i'm hoping that since Beard36 was kind enough to share the code, it wouldn't be too hard for someone to modify it for my situation. yes, i'm a novice in coding...any help is appreciated!

thanks...

emil

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top