none
Format Alert on days of the month! RRS feed

  • Question

  • I have 2 text boxes one box shows the Date the other box shows a number. Want im wanting is fi the date shows 1-2-17 and the number box shows 20 the background in the number box turns red. So if the date box shows 1-3-17 for march and the number box show 32 that text box will show red background. Tried Formatting but it doesn't know what month it is in. Thanks for any help............Bob

    xxx

    Friday, February 3, 2017 10:01 PM

Answers

All replies

  • Hi,

    Did you say you're using Conditional Formatting? If so, can you post the expressions you're using? Thanks.

    Friday, February 3, 2017 10:11 PM
  •  Thanks db, Just if tbDaycounter is greater than 31 turns box red but that only works for half the months of the year, Thought I could do a compare with two boxes tbDaycounter and another box using this function, but the function is not showing the proper amount of days last month

    Function dhDaysInMonth(Optional dtmDate As Date = 0) As Integer
        ' Return the number of days in the specified month.
        If dtmDate = 0 Then
            ' Did the caller pass in a date? If not, use
            ' the current date.
            dtmDate = Date
        End If
        dhDaysInMonth = DateSerial(Year(dtmDate), Month(dtmDate) + 0, -1) - _
         DateSerial(Year(dtmDate), Month(dtmDate), 0)
    End Function


    xxx

    Friday, February 3, 2017 11:01 PM
  • Hi, The number of days last month should be a simple: DateSerial(Year(Date),Month(Date),0) Right?
    Friday, February 3, 2017 11:36 PM
  •  

    Got my days in last Month right now [tbAlert], My Other text box [tbdaysCounted], how to I conditional format[tbDaysCounted] to turn red if the Number is greater than[ tbAlert]?  Thanks Bob

    Me.tbAlert = Day(DateSerial(Year(tbInvoiceDateInv), Month(tbInvoiceDateInv) + 1, 0))


    xxx

    Saturday, February 4, 2017 12:53 AM
  • How about?

    Expression Is: [tbDaysCounted]>[tbAlert]

    • Marked as answer by TurnipOrange Saturday, February 4, 2017 8:09 PM
    Saturday, February 4, 2017 2:26 AM
  • Thanks DB perfect ;)

    xxx

    Saturday, February 4, 2017 8:09 PM
  • Hi, You're welcome. Good luck with your project.
    Saturday, February 4, 2017 8:47 PM
  • BTW, What would be this months code? Thanks Bob

     Me.tbAlert = Day(DateSerial(Year(tbInvoiceDateInv), Month(tbInvoiceDateInv) + 1, 0))


    xxx

    Saturday, February 4, 2017 9:13 PM
  • Hi, If you meant how many days in the current month then: Day(DateSerial(Year(Date),Month(Date)+1,0)) Hope it helps...
    Saturday, February 4, 2017 11:30 PM