?
Solved

executing an access command button from VB5.0

Posted on 1998-07-15
5
Medium Priority
?
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 120 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

770 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