Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Code to show when the button was last clicked in access form

Posted on 2013-11-26
4
Medium Priority
?
1,056 Views
Last Modified: 2013-11-26
I need some code that generates text of when the button was last clicked.

Bottom line, the button is linked to a query and I need to know when the query was last run

so
button1 - button that runs the query
field1 the field that shows when the last time button 1 was clicked



thanks in advance,
Vinnie
0
Comment
Question by:damixa
[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
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39677884
private sub button1_click()

currentdb.execute "update tableName set field1=Now()"

me.field1.refresh
end sub
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39677900
Do you mean last clicked during the current session, or ever, by any user?

Generally, if you want to track application functionality and use, you create a separate table in your database for that, and then add code to events (Form_Open, Report_Open, cmd_XXX_Click, ...) which will populate that table.

I generally include fields for:

Form_Name
Event_Name
Event_DateTime
User_Name

Best way is to write a subroutine that writes to this information to the table and just call that subroutine from within each of the events you want to track.
0
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 total points
ID: 39677901
You can add something like this to your button:

Private Sub CommandButton1_Click()
   Me.Text1.Value = Now()
End Sub

Flyster
0
 

Author Closing Comment

by:damixa
ID: 39677962
Thanks Ton. This is what I was looking for!
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

722 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