In short, I am trying to have labels that are filled with dynamic content that will be based upon criteria in a field.
More specifically, I have created a report which has a [DateReceived] field (Date/Time) on it. I also have other fields with labels Day2, Day3, Day4, etc.
What I am trying to do is to have the labels 'Day2', 'Day3' express the date based upon the [DateReceived] field on the report.
If [DateReceived] = 4/2/2012 Then
Day2_Label = 4/4 <<<(The date format needs to be m/d)
Day3_Label = 4/5
In reference to this article:
I modified the code to arrive at:
When the report opens, it replaces the text string of the labels to "DateReceived". How can I get the code to replace the labels with the [DateReceived] value plus two days? Three days? The report is based upon a query whose parameters change, so the value in [DateReceived] can change also.Code:Private Sub Report_Open(Cancel As Integer) Dim strDay2Caption As String Dim strDay3Caption As String strDay2Caption = Me.DateReceived.ControlSource strDay3Caption = Me.DateReceived.ControlSource Me.Day2_Label.Caption = strDay2Caption Me.Day3_Label.Caption = strDay3Caption End Sub
I tried using the immediate window to arrive at a solution, but then I found out that Me. won't work in the immediate window. How then would I check the value of Me.DateReceived.ControlSource using the immediate window?