Results 1 to 3 of 3
  1. #1
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58

    Can Sub & Form Button Have Same Name?

    Hi, Everyone,

    I want to click a form button and run code in a STANDARD module (not the "behind the form" class module).

    I noticed the name (not the Caption) of my form button was different than the name of my Public Sub, so I changed the name of my
    Sub to match the name of the button. I started getting an error message.



    1) Are both Subs and buttons considered objects in Access?

    2) Should my Subs and buttons have different names?

    Any bit of information to clear this up for me will be appreciated. Thank you!

    Frank

    This post is also here http://www.utteraccess.com/forum/and...-t1983328.html
    and here http://www.access-programmers.co.uk/...d.php?t=222614

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    A subform is created by placing a subform container control on a form. This control has SourceObject property. The Object can be a table, query, form, report. Click the 'subform' once and you select the container control, click again and you select the form in the container control.

    Controls on the same form cannot have same name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58
    Solved:

    I decided to change my names back...they're all different now.

    I haven't written anything with an Function procedure yet, so I didn't want any unforseeable errors to be thrown. For that reason I went with Call subs in my form class module. I used Event Procedures in my Event property to point to them.

    Thank you.

    Frank

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  2. Replies: 1
    Last Post: 11-21-2011, 07:58 AM
  3. Replies: 1
    Last Post: 07-18-2011, 03:08 AM
  4. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  5. Replies: 0
    Last Post: 02-15-2011, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums