Results 1 to 3 of 3
  1. #1
    GregHolden is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    5

    If then else question


    Hello everyone,

    I know there are a million posts about this question, but I have another one. I will preface this by saying I am not a programmer and had this project handed to me by my supervisor, so I apologize if the code looks ugly.

    I am attempting to automatically update a record when a form is completed. There are two fields I am trying to update, the first one is working perfectly [Class of Arrest], however the second one [Class of Report] is not updating the field at all.

    I appreciate any assistance anyone can provide.


    Private Sub Class_of_Arrest_Click()
    If [CRIA Felony Arrest] > 0 Or [Non-CRIA Felony Arrest] > 0 Then
    [Class of Arrest] = "Felony"
    ElseIf [CRIA Misdemeanor Arrest] > 0 Or [Non-CRIA Misdemeanor Arrest] > 0 Or [CRIA Domestic A B Arrest] > 0 Or [Non-CRIA Domestic A B Arrest] > 0 Or [CRIA Mental TDO] > 0 Or [Non-CRIA Mental TDO] > 0 Then
    [Class of Arrest] = "Misdemeanor"

    End If






    End Sub


    Private Sub Class_of_Report_Click()
    If [CRIA Felony Report] > 0 Or [Non-CRIA Felony Report] > 0 Then
    [Class of Report] = "Felony'"
    ElseIf [CRIA Misdemeanor Report] > 0 Or [Non-CRIA Misdemeanor Report] > 0 Or [CRIA Domestic Report] > 0 Or [Non-CRIA Domestic Report] > 0 Then
    [Class of Report] = "Misdemeanor" > 0
    Else
    [Class of Report] = "Supplement"
    End If


    End Sub

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    The only this I see wrong is this:

    [Class of Report] = "Misdemeanor" > 0

    This sets [Class of report] to True or False.

    It should of course be : [Class of Report] = "Misdemeanor"

    Other than that, I don't see anything wrong with the code. If it still doesn't work, then you may have a problem with the data.

    John

  3. #3
    GregHolden is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    5
    Thanks for the assist John - looks like it was just a typo. I appreciate it.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums