Solved

Capturing Choices from frmMainMenu

Posted on 2011-03-20
5
430 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
[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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

756 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