Solved

Activate Command

Posted on 2009-04-02
4
246 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 150 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 200 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 150 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 59
VBA error replacing data 6 40
VB6 Compile Compatibility Issue 4 102
How to debug this code 7 61
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 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…
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…

772 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