How to get date & time for report footer

dorisr

Programmer Analyst
Local time
Today, 18:52
Joined
May 5, 2008
Messages
15
Hi all,
I need to put the current date and time in a report footer.



This is the code I have in a textbox of the report footer right now and it works...
="Printed the " & Format(Now(), "dd-mm-yyyy hh:mm")

But when I change pages, the time is update... So the first page can have a time of
05/03/2009 09:48 and the second page can have a different time ex 05/03/2009 09:49.

I need probably to get the date time only in the report_open function...

Can someone help me on this ?

Thanks,
Doris
 
And put the current DateTime in a variable. Then print the variable in the footer instead of a refreshed NOW().
 
Hi RuralGuy,
Thanks for your poste. Can you give me some example of using the report_open procedure....

If I initialise a new variable as sting and use this variable in the footer...

Private Sub Report_Open(Cancel As Integer)
Dim txt_time_stamp as string

txt_time_stamp = "Printed the " & Format(Now(), "dd-mm-yyyy hh:mm")
msgbox(txt_time_stamp)
End Sub

Can I use the txt_time_stamp variable in my footer ?

Thanks,
 
Yes, except you need to Dim the variable outside of the procedure so that it is available to the report. Put it right under:
Code:
Option Compare Database
Option Explicit

Dim txt_time_stamp as string

Private Sub Report_Open(Cancel As Integer)
 
Hi RuralGuy,
I have done it but still not working...

In my report footer, I have my text box value of control source =[txt_time_stamp] but it doesn't have the value in it... do you know why ??
 
Yes, except you need to Dim the variable outside of the procedure so that it is available to the report. Put it right under:
Code:
Option Compare Database
Option Explicit

Dim txt_time_stamp as string

Private Sub Report_Open(Cancel As Integer)
sorry,,,, it works :)...

I have declare it as :
Public txt_time_stamp As String
Option Compare Database
Option Explicit
Public txt_time_stamp As String
Private Sub Report_Open(Cancel As Integer)
txt_time_stamp = "Printed the " & Format(Now(), "dd-mm-yyyy hh:mm")
MsgBox (txt_time_stamp)
End Sub

Thanks a lot
 
Yes, except you need to Dim the variable outside of the procedure so that it is available to the report. Put it right under:
Code:
Option Compare Database
Option Explicit
 
Dim txt_time_stamp as string
 
Private Sub Report_Open(Cancel As Integer)

public txt_time_stamp as string
 

Users who are viewing this thread

Back
Top Bottom