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
Solved

Activate Command

Posted on 2009-04-02
4
247 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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 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…

856 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