1.

Solve : VBA Access 2010 - Assigning text to a label caption?

Answer»

So I have an on-click event, a SQL query that imports a bunch of data to my SQL db. That all works FINE. I want to add a function which then writes a date/time stamp on several FORMS that I decided are relevant. I'm already got it working in a few forms, but I rand into a bump in the method I'm using. Here's the code I have now:

Code: [Select]Private Sub DateTimeLastUpdated()
Dim strUpdateMsg As String
Dim strUpdateDate As String
Dim strUpdateTime As String

strUpdateMsg = "Las Updated: "
strUpdateDate = Date
strUpdateTime = Time

Forms!Main!LblLasUpdated.Caption = strUpdateMsg & strUpdateDate & " " & strUpdateTime
Me.LblLasUpdated.Caption = Forms!Main!LblLastUpdated.Caption

All of this works fine (And it works on all forms listed plus more). The problem that I run into though, is that it will only execute if the form is open. If the form is CLOSED, it will not update the label, and will cause errors in my script. So the question is:

What can I do so that it will assign the CONTENT to EVERY listed label across the entire project even if they are closed, don't have focus, whatever.

If you just want to point me in the right direction, that is still greatly appreciated. And feel free to judge my code... but I only accept nice words. I've decided to go another direction with this, so I don't really need the answer now. Thanks to everyone for taking a look, an I'm sure I'll have another thread soon enough.

Mods (Calum, Allen, patio, an all) feel free to lock this for me if you want.



Discussion

No Comment Found