Access VBA - Form last run

Posted on 2014-07-11
Last Modified: 2014-07-14
I have a MDB where it is important users do not re-run a db twice as there are append queries

Can i have a piece of code that displays the last time the form was ran as the form opens

So i have a form that opens as the DB opens, i would like a msgbox to pop up displaying the last time the button on the form was executed

Many thanks
Question by:Seamus2626
    LVL 17

    Accepted Solution

    Hi Seamus
    One idea may be to create a new table in your Database application named tbl_SystemActions.
    This table could have 2 fields: Action and ActionDate.

    Add an extra piece of code behind the click event of the button in question - e.g.
    DoCmd.RunSQL "insert into tbl_SystemActions VALUES ('OrderButtonClicked','" & Date() & "')"

    You could then read back from the tbl_SystemActions table OnFormLoad and display the latest Action date/time for the Action in question.

    The advantage of having such a tbl_SystemActions table is that if in the future you wished to record details of other actions taken by users in the system or events occurring in the system itself

    Author Comment

    Thats a great idea Barry, il set that table up and query from there

    Many thanks

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    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…

    731 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

    18 Experts available now in Live!

    Get 1:1 Help Now