Solved

Capturing Choices from frmMainMenu

Posted on 2011-03-20
5
407 Views
Last Modified: 2012-05-11
Hi,

I have a form called frmMainMenu (!).
It has 10 menu options which is basically calling other forms.

I want an Audit log - if possible by coding ONLY the frmMainMenu.

I.e. I want a line of VBA in the frmMainMenu which captures the option chosen from the menu.

The idea is that I get an audit like "UserA chose Menu Option xxxxx at 6pm". Under what "event" do I write this code??

I do NOT want to write the code in each of the 10 options - I want to write it just once - in the main menu


0
Comment
Question by:Patrick O'Dea
5 Comments
 
LVL 21
ID: 35176587
I would use an append query to add the data to a table. You could run this append query  just before you open the form.

I find it best to use separate field in the audit log table:
LogDate  - date Time - default Now()
WindowsUserName
DatabaseUserName
ObjectName
Action
ActionDescription


0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 35176595
I have been doing Audit logs in my database for 15+ years in Access. I have found it best to create a public function that you can call.  I also have find it best to use the On load and On close events of forms and reports to call the logging function. This way it does not matter how/where the form or report was opened.
0
 
LVL 13

Expert Comment

by:lee555J5
ID: 35176646
Are your 10 options part of an option group? If so, you can code your audit in the option group's AfterUpdate event. If not, you may want to redesign your form using the option group solution.

If you draw a frame control with toggle buttons on your form using the wizard, it does most of the work for you. The frame is now your option group's container. Add your next-form-opening code and your audit code to the frame's AfterUpdate event.

Lee
0
 
LVL 44

Expert Comment

by:GRayL
ID: 35176677
The 10 menu Items should be in an Option Group control from which you can select only one item at a time.  This control is give a name such as Frame1 and each option box is given a value 1 to 10.   The Option Group  has a click event that will fire when any of the ten items are selected.  You can determine which one fired by examining the value of the control after the click.  By naming the controls opt1 to opt10 you can determine the name of the control that fired by appending the value of the Option Group to "opt".   Assuming you have no trouble aggregating the components of the audit string, to answer the question, put the code in the click event of the Option Group.

0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35176694
Thanks very much .

That will do nicely.

You are 14 years ahead of me!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

862 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now