Solved

executing an access command button from VB5.0

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

688 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