Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Activate Command

Posted on 2009-04-02
4
Medium Priority
?
257 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
[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
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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

721 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