Solved

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

Posted on 2013-11-26
4
1,045 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month3 days, 15 hours left to enroll

630 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