Last Run date & time stamp

G

Guest

I have a form, with a series of buttons that call procudures. Under each
button I would like a box that states the date and time the action behind
the button was last completed.

Button A
March 17, 2006 12:45:06 AM
Button B
December 1, 2005 1:12:32 PM
Button C
January 6, 9:02:56 AM
Button D
February 23, 2006 10:35:16 AM

A pointer to a website with the instructions would be great as I am new to
this.

Thanks,
Hank
 
A

Al Camp

Hank,
You'll have to add fields to your table to hold those date values. (ex.
ButtonALastRun, ButtonBLastRun, etc...)
In the event procedure code behind the ButtonA OnClick event...
ButtonALastRun = Now()
etc... for each button.

Format the date fields with...
mmmm dd", "yyyy hh:nn AM/PM
to get the display you want.
 
G

Guest

OK, That sounds pretty straight forward. Just want to ensure I understand
the TBL structure though.

This would be a new TBL, called say Actions

COL1, COL2, COL3, COL4 - 1 column for each button, correct?
 
G

Guest

OK, I've created the TBL, but I already have an OnClick event, and that is to call the macro that calls the procedure.

So how do I code it to do 2 things. Or more aptly, after the procedure completes, is the Date and Time I want.

My procedure ends with the following lines:

' Turn Warnings back ON
DoCmd.SetWarnings True
' Close Status Meter
Call acbCloseMeter

AddressConversionScrub_Exit:
Exit Function

AddressConversionScrub_Err:
MsgBox Error$
Resume AddressConversionScrub_Exit

End Function

So where in the above would I add the instruction set?

Hank
 
A

Al Camp

Hank,
You don't really need a new table, just add the four new fields to the
table behind the form.

tblYourTableNameBehindTheForm
Add these new fields...
FieldName Type
ButtonALastRun Date
ButtonBLastRun Date
etc... for each button.

And yes... these will appear as new "columns" in your
tblYourTableNameBehindTheForm datasheet table view.
 
G

Guest

I see what your saying. Yeah, My Form isn't a "REAL Form" i.e., it does
not pull or display data from any of my TBLs, nor is it linked to any of my
TBLs.

It is simply a Form that contains Command Buttons that call Macros and
Procedures to scrub my backend data. (i.e. I needed to create something
VERY VERY non-technical for one of my staff. Click Button 1, Once complete,
Click Button 2, ... Each Procedure, steps through a large number of queries
that take a few hours to complete... (It's a small P4 box, that needs an
upgrade desperately)

Hank
 
G

Guest

OK, I've decided to go about this a different way.

What is the syntax I would add to the end of this stored procedure below to update TBL.COL "Actions.Button1LastRun" with the Time and Date Stamp of the procedure completing?
OK, I've created the TBL, but I already have an OnClick event, and that is to call the macro that calls the procedure.

So how do I code it to do 2 things. Or more aptly, after the procedure completes, is the Date and Time I want.

My procedure ends with the following lines:

' Turn Warnings back ON
DoCmd.SetWarnings True
' Close Status Meter
Call acbCloseMeter

AddressConversionScrub_Exit:
Exit Function

AddressConversionScrub_Err:
MsgBox Error$
Resume AddressConversionScrub_Exit

End Function

So where in the above would I add the instruction set?

Hank
 
A

Al Camp

ButtonALastRun = Now

But this won't work if your form is not bound to a table. Bind your form with the table you created, with the 4 fields. For testing purposes, show them on the form... later you can hide them if you want.
There will always be just one record with 4 fields, and each time ButtonA runs, set the AButtonLastRun date field to Now. The same for each of the other buttons, using 4 separate procedures... one for each button You just keep updating the same 4 values over and over.

For Button A...
' Turn Warnings back ON
DoCmd.SetWarnings True
' Close Status Meter
Call acbCloseMeter
ButtonALastRun = Now

AddressConversionScrub_Exit:
Exit Function

AddressConversionScrub_Err:
MsgBox Error$
Resume AddressConversionScrub_Exit
End Sub

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

OK, I've decided to go about this a different way.

What is the syntax I would add to the end of this stored procedure below to update TBL.COL "Actions.Button1LastRun" with the Time and Date Stamp of the procedure completing?
OK, I've created the TBL, but I already have an OnClick event, and that is to call the macro that calls the procedure.

So how do I code it to do 2 things. Or more aptly, after the procedure completes, is the Date and Time I want.

My procedure ends with the following lines:

' Turn Warnings back ON
DoCmd.SetWarnings True
' Close Status Meter
Call acbCloseMeter

AddressConversionScrub_Exit:
Exit Function

AddressConversionScrub_Err:
MsgBox Error$
Resume AddressConversionScrub_Exit

End Function

So where in the above would I add the instruction set?

Hank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top