Change Button Text before close

dgs2001

Board Regular
Joined
Apr 1, 2007
Messages
139
Hi All

First up I'm new to access but have a reasonable grip on excel and vba.

I have a database with one table which has a field called EVENT_DT which stores data like this
Code:
 23/05/2010 16:45

I also have a form called Form1 which has a command button called command2 with the following text on it "Click to save Results Last saved date : 21/05/2010"


What i would like to be able to do is have the date part of the button text auto update by looking for the newest date in the EVENT_DT Field either at database / form opening or before close.

Thanks for any pointers

Duncan
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Duncan

Why not have a textbox on the form with it's control source being an expression that returns the last save date?

That would be easier to do than change the caption of a button - you wouldn't even need any code.
 
Upvote 0
Hi Norrie

Thanks that sounds like a good idea, although i may not have explaned it properly.

For ease of use I am trying to display the last Event Date the database was updated to.

This will be different to the actual save date.

So the textbox would need to display the newest date from the EVENT_DT Field in "dd/mm/yyyy" format.

I'm thinking MAX, but am unsure how to work this into an expression.

Duncan
 
Upvote 0
I think I'm getting there !!

I have created a text box and put this code into it
Code:
=IIf(IsNull([EVENT_DT]),Null,Max([EVENT_DT]))
however it returns #Name?

I think the
Code:
 MAX([EVENT_DT])
is wrong
 
Last edited:
Upvote 0
More Progress !!

I have created a query which returns the required Newest date from the EVENT_DT Field

I have also created a list box which displays the results of the query.

so now all i need to do is either restrict the listbox to a single item or hide it and use the first (and only) item to populate my textbox.

I am stuck now so please help !!!

Duncan
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,181
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top