Solved

executing an access command button from VB5.0

Posted on 1998-07-15
5
153 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now