Results 1 to 6 of 6
  1. #1
    martingaleh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    22

    Running code from a control in a continuous subform

    I have a subform B in form A. Subform B is a continuous form to which I added a button. This same button, of course, appears in every record so I have to figure out which record is the active record after the button is clicked.



    When I create the button, I added an event procedure for the click event. The program takes me to Private Sub Command21_Click(), to which I added the code below:
    Code:
    Private Sub Command21_Click()
        MsgBox ("Hello!")
    End Sub
    I know I'm in the right place, because on the top of the ide window are the words (essentially) Form_B subform(Code)

    When I click the button, there is no msgbox. When I put a stop, the code doesn't stop.

    I then made a macro for the click event with two items
    runcode - Forms!A!B.Form!Command21_Click
    Msgbox ("Did it work")

    A msgbox pops up with "Did it work"
    No msgbox for "Hello"
    This same result happens when I step through the code

    Then I tried runcode Forms!A!B.Form!Command21_Clickthisshouldn'twork

    Same thing happens

    Then I tried runcode expletives deleted
    Msgbox ("Did it work")

    And step through the code. The error comes up, can't find expletives deleted To access procedures in other forms etc. etc.

    How can I get code to fire for a click in the subform

    Here are some pictures
    Click image for larger version. 

Name:	Clipboard01.png 
Views:	12 
Size:	284.7 KB 
ID:	22143

    Click image for larger version. 

Name:	Clipboard02.png 
Views:	12 
Size:	221.4 KB 
ID:	22144
    Click image for larger version. 

Name:	Clipboard03.png 
Views:	12 
Size:	236.8 KB 
ID:	22145

    There's more. When I look at the controls that the IDE acknowledges, Command21, my button isn't even listed
    Click image for larger version. 

Name:	Clipboard04.png 
Views:	11 
Size:	228.3 KB 
ID:	22147

    But when I added the Controltiptext, just to see if the properties window on the side is real, the text shows up upon hovering
    Click image for larger version. 

Name:	Clipboard05.png 
Views:	11 
Size:	255.5 KB 
ID:	22148

    Can I just say that javascript is infinitely easier. There's no form subform nonsense. The objects aren't nested on into the other, and when there's an error, the browser throws it.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Cannot replicate issue. Works perfect in my db. If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Quote Originally Posted by martingaleh View Post
    Can I just say that javascript is infinitely easier. There's no form subform nonsense. The objects aren't nested on into the other, and when there's an error, the browser throws it.
    Right, but Javascript in browser would require you to implement your own async callbacks to achieve the same level of integration.

    Can you set a break point in the continuous forms events and trap it? If you can you can highlight a related object and shift + F9 the object.

  4. #4
    martingaleh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    22

    Please clarify

    Quote Originally Posted by Perceptus View Post
    Can you set a break point in the continuous forms events and trap it? If you can you can highlight a related object and shift + F9 the object.
    i can't set a breakpoint because the delegate doesn't actually fire. You can see I tried to set a breakpoint, but it didn't break

    I don't know what you mean by I can highlight a related object and shift f9 but it sounds intriguing. Does that mean if I highlight a procedure or function of some sort and hit f9 it will tell me the full object name life forms!formname.subform!form!procedure. I'm going to try to upload a subset of this thingy of mine.

    i've learned access isn't so great with the multithreading because sometimes you have to do weird things for tables to refresh or forms to fill out. It's like they aren't subscribing to threads correctly

    Finally, the sync calls in JavaScript aren't hard if you use dojo. Well that's not true any more. It used to be .addCallback, but now it's .on and in the future it's going to be something else. No sense programming now if the whole ground will shift in 2.0. That's why I'm using access now. I need something that's stable for at least a decade

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Did you see post 2?
    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.

  6. #6
    martingaleh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    22

    Yes I did

    Quote Originally Posted by June7 View Post
    Did you see post 2?
    I referred to it with the "I'm going to try that upload thingy" part of my post. BUT, I found the solution!! I dont' have time to try to repeat it, but here it is.

    Step 1. Save all and Quit
    Step 2. Play Street Fighter 2 on a program that makes the pc pretend its a super nintendo as Guile. Guile always loses to Ryu. ALWAYS. This will make you more frustrated than Access.
    Step 3. Watch Late Show with Stephen Colbert
    Step 4. Open database again. It will suddenly work. Inexplicable but true!! Some thread must have failed to resolve, finally did when newly opened and voila. My button click event fired and my delegate executed.

    Thanks so much for your help.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-12-2015, 12:03 AM
  2. Replies: 4
    Last Post: 04-20-2015, 12:36 PM
  3. Replies: 7
    Last Post: 06-30-2014, 07:44 AM
  4. Replies: 3
    Last Post: 04-03-2014, 08:13 AM
  5. Lebans Continuous Forms Control Tip - In Subform
    By Whizbang in forum Programming
    Replies: 4
    Last Post: 01-16-2013, 08:17 AM

Tags for this Thread

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