Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Activate Command

Posted on 2009-04-02
4
Medium Priority
?
260 Views
Last Modified: 2012-05-06
How to activate the command to  the main form from other form?
example: My Main form is mainfrm then the other form is form1.
in mainfrm i have a code like this
Public sub kick()
msgbox "hello"
end sub
now i go to form1, then i want to activate kick upon downloading the form1. here's my command

Private Sub Command1_Click()
Unload me
kick
End Sub

My code is not working.
Please give some example to do this?
Thanks!
 
0
Comment
Question by:Whing Dela Cruz
4 Comments
 
LVL 1

Assisted Solution

by:deepakra79
deepakra79 earned 600 total points
ID: 24047559
You need to call mainfrm.kick as below

Private Sub Command1_Click()
Unload me
mainfrm.kick
End Sub

To call any function directly it should be in module instead of form.
0
 
LVL 11

Accepted Solution

by:
bmatumbura earned 800 total points
ID: 24047593

Private Sub Command1_Click()
  Me.Visible=False
  kick
  Unload me
End Sub

Open in new window

0
 
LVL 11

Assisted Solution

by:Antagony1960
Antagony1960 earned 600 total points
ID: 24047627
Also, you're having form1 unload itself and then continuing to run code from within that form's module. Strictly speaking the unload command should be very the last thing it does. You'd get away with it in this instance but any significant amount of code following the unload command may prevent the form from unloading. This is the better way to do it:

Private Sub Command1_Click()
Me.Hide
mainfrm.kick
Unload Me
End Sub
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 31565683
Thanks to guys!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Suggested Courses

885 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