Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2013
    Posts
    99

    Unanswered: Conditional Formatting

    I have the following expression in my conditional Formatting that changes the backcolour if the feild is null but it does not change it back to white if there is any entry

    It is based on a date

    Any ideas

    IsNull([Date of Previous Visit1]+[Date of Previous Visit2]+[Date of Previous Visit3]+[Date of Previous Visit4]+[Date of Previous Visit5]+[Date of Previous Visit6]+[Date of Previous Visit7]+[Date of Previous Visit8]+[Date of Previous Visit9]+[Date of Previous Visit10+[Date of Previous Visit11+[Date of Previous Visit12+[Date of Previous Visit9]+[Date of Previous Visit13+[Date of Previous Visit14+[Date of Previous Visit15])

    Thank you

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    Else If Not IsNull YourCodeHere

  3. #3
    Join Date
    Feb 2013
    Posts
    99

    Conditional Formatting

    Burrina

    I am using the expression builder in conditional formatting do I just put infront "not isnull" instead of "isnull"

    Thanks

  4. #4
    Join Date
    Nov 2011
    Posts
    413
    If IsNull([Date of Previous Visit1]+[Date of Previous Visit2]+[Date of Previous Visit3]+[Date of Previous Visit4]+[Date of Previous Visit5]+[Date of Previous Visit6]+[Date of Previous Visit7]+[Date of Previous Visit8]+[Date of Previous Visit9]+[Date of Previous Visit10+[Date of Previous Visit11+[Date of Previous Visit12+[Date of Previous Visit9]+[Date of Previous Visit13+[Date of Previous Visit14+[Date of Previous Visit15]) Then
    Me.YourFieldName.BackColor = vbRed
    EsleIf Not IsNull([Date of Previous Visit1]+[Date of Previous Visit2]+[Date of Previous Visit3]+[Date of Previous Visit4]+[Date of Previous Visit5]+[Date of Previous Visit6]+[Date of Previous Visit7]+[Date of Previous Visit8]+[Date of Previous Visit9]+[Date of Previous Visit10+[Date of Previous Visit11+[Date of Previous Visit12+[Date of Previous Visit9]+[Date of Previous Visit13+[Date of Previous Visit14+[Date of Previous Visit15]) Then
    Me.YourFieldName.BackColor = vbWhite
    End If
    Last edited by Burrina; 10-05-13 at 12:07. Reason: VBA Code.

  5. #5
    Join Date
    Feb 2013
    Posts
    99

    Why is this not working

    Decided to keep it simple and it still does not work

    If I load the Form the VBA code works but the afterupdate on putting the code into the oncurrent event does not work

    cannot figure it out because it should work

    Private Sub Date_of_Previous_Visit1_AfterUpdate()
    If Me.Date_of_Previous_Visit1 & "" = "" Then
    Me.Date_of_Previous_Visit1.BackColor = vbRed
    ElseIf Me.Date_of_Previous_Visit1 & "" = "" Then
    Me.Date_of_Previous_Visit1.BackColor = vbWhite
    End If
    Me.Refresh
    End Sub

    Private Sub Form_Load()
    If Me.Date_of_Previous_Visit1 & "" = "" Then
    Me.Date_of_Previous_Visit1.BackColor = vbRed
    ElseIf Me.Date_of_Previous_Visit1 & "" = "" Then
    Me.Date_of_Previous_Visit1.BackColor = vbWhite
    End If
    End Sub

  6. #6
    Join Date
    Nov 2011
    Posts
    413
    You should have a OnCurrentEvent and a AfterUpDateEvent. You do not need a OnLoadEvent. You may need a IsDate to make it work or Not IsDate. Do you have other code in the OnCurrentEvent ?

  7. #7
    Join Date
    Feb 2013
    Posts
    99

    Resolved

    I have to recreate the Form form Scratch and now it works not sure why as this was the only code in the form

    Thanks

  8. #8
    Join Date
    Nov 2011
    Posts
    413
    Glad you got it working.Good Luck with your project.

Posting Permissions

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