Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2004
    Posts
    47

    Unanswered: Date Expression Problem

    Another problem came up with my form.

    In my form I have a field called Loan Date and Expected Return Date.
    I would like to check whether todays date is bigger than the Expected Return Date and if so color the Expected Return Date Label.

    I tried adding this code


    If txtExpectedReturnDate >= Date Then
    Me.lblExpectedReturnDate.BackColor = Red
    Else
    Me.lblExpectedReturnDate.BackColor = Black
    End If

    But I think I am making a mistake somewhere or I am not putting it in the right place again.

    Thanx

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    where did you put this code in?
    ghozy.

  3. #3
    Join Date
    Sep 2004
    Posts
    47

    placec

    Well I put it in the Form_Load() and in the Form_Open() but both did not work

  4. #4
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    did you check your labels' backstyle property is set to Normal?
    ghozy.

  5. #5
    Join Date
    Sep 2004
    Posts
    47

    I think I fixed it

    ghozy:

    Thank you very much. It did not work on the places I placed it before.
    Instead I placed it in Form_Current() and changed the code a bit:

    If txtExpectedReturnDate <= Date Then
    Me.lblExpectedReturnDate.ForeColor = vbRed
    Else
    Me.lblExpectedReturnDate.ForeColor = vbBlue
    End If

    Thank you for pointing at my mistakes :-)

  6. #6
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    well I'm glad I could kinda help. you did figure it out yourself though.
    ghozy.

Posting Permissions

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