Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Pros please: Form Button click event 1

Status
Not open for further replies.

lachesis

Technical User
Sep 25, 2002
138
NZ
I have a form which is essentially a collection of buttons, navigating users to other forms.

Here's what I want to happen:

1. User clicks button for desired form
2. The current form senses the button click event & closes itself
2. The desired form opens.

I already have 'open form' macro events attached to each of the form navigation buttons, so I can't use the On Click event - it already has the macro assigned to it.

Help!?
L.
 
L,

Use VB instead of macros. The wizard will help you thru opening the new form. You could on the on_open event in the properties of that form close the old form by

forms![OldForm].close


rollie@bwsys.net
 
You can add the functions you desire to close the Open form by adding the close function (if you leave the form name blank it should close the active form) before the OPen form function inside your current Macros.

If you do wish to perform this using VB I can provide code for you.


 
Thanks, both good answers but prefer bhoran's idea since I refer to the same macros on other forms, where I want the same outcome.

cheers
L.
 
In building things in the future you may wish to take up Rolliee's advice on the VB it can make things more flexible, and you can add parameters.

For example I have a several groups of users that can view reports but due to security they navigate there using different forms, by using VB variables I can determine which form the used to get there and therefore what functions to perform when they click on buttons or exit reports.

However if you already have the Macros for this database it will prob save you time to simply modify them.

P.s. Thanks for the star.
 
in the on click event put this:-

DoCmd.OpenForm "New form to open", acNormal, "", "", , acNormal
DoCmd.close acForm, "old form to close"





keep it simple

Be ALERT - Your country needs Lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top