Results 1 to 7 of 7
  1. #1
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46

    Expression written to a Form


    Needs some help.

    I have an expression that I have written to form.

    Code:
    If IsNull([Coding Errors]) And IsNull([MM changes after WF sent]) Then
     [Note].Value = ""
    Else
    [Note].Value = "Note is required"
    This is working fine. I need to add another requirement. If the [Note Included] checkbox is clicked then
    The [Note].Value is "Note is present".

    I have tried writing this several different ways with no luck. Either the "Note is present" is on every record or the first expression doesn't work at all.

    Thanks for any help.

    Holli

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Not sure what you want. Not enough code to see where you are headed.

    Maybe this???
    Code:
        If IsNull([Coding Errors]) And IsNull([MM changes after WF sent]) Then
            [Note].Value = ""
        Else
            If [Note Included] Then
                [Note]= "Note is present"
            Else
                [Note]= "Note is required"
            End If
        End If
    * "Value" is the default property and doesn't need to be typed - doesn't hurt, but not necessary.
    * Shouldn't use spaces in object names. ( CodingErrors is a better field name than [Coding Errors] )
    * "Note" is a reserved word in Access. Here is a list of reserved words:
    http://www.allenbrowne.com/AppIssueBadWord.html

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    If the first part returns true, the else is not processed, no? ssanfu is correct in that you have not provided enough info. If your new requirement is not dependent on the other two, it is just another if, then, end if clause. Otherwise, it may need to be nested.

  4. #4
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Thanks Steve and Micron

    The [NotesIncluded] = "Note is Present" is a separate requirement by itself.

    When I try write it as new requirement it doesn't work Or the first requirement doesn't work.

    I need to use a nested statement?

    Thanks for your help and the link.

    Thanks

    Holli

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Post more of the code and indicate where you think it should go.
    If it is a separate requirement, this should work:
    Code:
            If [Note Included] Then
                [Note]= "Note is present"
            End If
    But without seeing the code, it is really hard to say where it should go.
    What is "[NotesIncluded]"? the name of a control on the form or a field on the record source?

  6. #6
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Working, PERFECT!
    Thanks

    Code:
    If IsNull([Coding Errors]) And IsNull([MM changes after WF sent]) Then
     [Note].Value = ""
    Else
    [Note].Value = "Note is required"
    End If
    If [Note Included] Then
    [Note] = "Note is present"
    End If

    Thank you

    Holli

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Wonderful...

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

Similar Threads

  1. Replies: 4
    Last Post: 04-18-2015, 07:18 AM
  2. feedback on query written
    By Compufreak in forum Access
    Replies: 1
    Last Post: 08-29-2012, 06:16 PM
  3. Replies: 2
    Last Post: 07-19-2011, 04:28 PM
  4. Close Form, No Changes Written
    By shelzmike in forum Access
    Replies: 18
    Last Post: 06-30-2011, 10:36 PM
  5. OLE object not written to database
    By Jean-Louis Leroy in forum Forms
    Replies: 0
    Last Post: 06-08-2010, 02:08 AM

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