Solved

executing an access command button from VB5.0

Posted on 1998-07-15
5
167 Views
Last Modified: 2010-05-03
I want to write code that execute a command button from VB.


I've tried this:

db.Form1!Command1.Value = -1

nothing seems to work.  What is the correct way to do this?

Thanks
0
Comment
Question by:dhill10358
5 Comments
 
LVL 2

Expert Comment

by:lortega
ID: 1465849
please explain the question!
0
 

Author Comment

by:dhill10358
ID: 1465850
I thought it was pretty straight forward.  For example when I click a button on a form in VB5.  it will open the access database and  "click" the command button on the access database.  

Thanks

0
 

Expert Comment

by:biko071598
ID: 1465851
If you want it to click a button on an access form, make sure the button has a hot key assigned to it and then use appactivate and sendkeys to 'click' the button.
0
 
LVL 2

Accepted Solution

by:
swilt earned 40 total points
ID: 1465852
Put this in the code module for Command1

Public Sub BuzzCommand1()
    Command1_Click
End Sub

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

    MsgBox "hello"

Exit_Command1_Click:
    Exit Sub

Err_Command1_Click:
    MsgBox Err.Description
    Resume Exit_Command1_Click
   
End Sub


Then just call the sub
db.Form1.BuzzCommand1

p.s. you cannot call Command1_Click directly because it is Private
0
 
LVL 2

Expert Comment

by:mtoft
ID: 1465853
Or you could simple change the declaration from

Private Sub Command1_Click()
 ' something
End Sub

to

Public Sub Command1_Click()
    MsgBox "YO"
End Sub


Then the call would be like:
db.Form1.Command1_Click



Not very nice, but hey - its basic and it works :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question