CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    33

    Click a button from VB - Access 2000

    Hello,

    Is it possible to "click a button" on the form, using the VB code? I have a button which is handled by a macro. And I need to "click" this button from VB (i.e. to execute that macro) when the user presses Enter on a different control on the form.

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: Click a button from VB - Access 2000

    I suppose that your button already has a VBA subroutine associated with the onClick event (if not, then rightclick on the button in creation mode, in order to get the property dialog box, and then click on the line for the onClick event). For instance, if your button is named "Bt1", you should see this in the VBA editor:
    Code:
    Private Sub Bt1_Click()
    .... blabla
    End Sub
    Then, this subroutine can be called from anywhere with:
    Code:
    Call Bt1_Click

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured