Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Capturing Choices from frmMainMenu

Posted on 2011-03-20
5
Medium Priority
?
452 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 2000 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

Industry Leaders: 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…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

610 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