Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2012
    Posts
    3

    Unanswered: IN Report, make one field visible based on date of another field

    Hello all, i'm a relatively new to Access.

    I have a subform with 8 fields, the last 2 fields being Todays_Date and Did_Today. On this report I want the first 6 fields to always show, however I only want Todays_Date and Did_Today to be visible ONLY if Data was inputed for the day your viewing the report. This is kicking my but and frustrating me to no end. I've tried many methods i've found through searches but nothing seems to work. I've mainly focused on simply having the Did_Today field visible if the Todays_Date field matches the current date. I can live with the Todays_Date field always visible.

    This is the latest coding i've attempted:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If [Todays_Date] = Date Then
    Me.Did_today.Visible = True
    Else
    Me.Did_today.Visible = False
    End If
    End Sub

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Does this work?

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.Todays_Date = Date Then
         Me.Did_today.Visible = True
    Else
         Me.Did_today.Visible = False
    End If
    End Sub


    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Dec 2012
    Posts
    3
    I tried that, still shows data in my "Did_today" field with previous dates.

    As for specifics, I open my subreport in design mode, I click on DETAILS section and open properties, i click the all tab and at ON FORMAT, I create EVENT PROCEDURE using code builder. Does this sound right? or should I be creating this event in another area?

  4. #4
    Join Date
    Dec 2012
    Posts
    3
    I figured it out, I'm using Access 2007 and it only displays properly when viewing in Print View. Unless someone has a way of getting it to display properly in REPORT VIEW, i've got my solution.

    This is the code that's working:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.Todays_Date = Date Then
    Me.Did_today.Visible = True
    Else
    Me.Did_today.Visible = False
    End If

    End Sub

    Thanks Missinglinq

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •