Results 1 to 4 of 4
  1. #1
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152

    Back color update issue

    Hello,

    I have a button which at the end of the form the user hits to validate all repsonses and completes the survey. If fields are missing they highlight red.

    However some combo boxes auto fill other combo boxes depending on a repsonse. (They also hide these fields when filled in but that is not relevant at the minute)

    The issue:


    Say a user selects an option which auto fills other fields and then realises that that was a mistake and changes it.
    The autofilled fields are set to (= "") So they become blank again.
    However if they forget to fill in one of these fields and try to complete the survey it does not highlight RED but it is required so will not complete, therefore rendering the user confused.
    However I have noticed that if you reenter one of these autofilled fields which are now blank and select something and delete it manually and then press the complete button it highlights red. Therefore leading me to believe that the (me.fieldname = "") is causing the issue - not actually making the field null!

    Any help much appreciated!
    Thanks

  2. #2
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    RESOLVED:
    Changed the autofill code to:
    Me.fieldname = Null (upon selection in the combobox)

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    GraemeG, Be cautious with x = NULL

    The syntax is along these lines
    if IsNull(fieldname)......

    See this link for an explanation of NULL Empty etc.
    http://allenbrowne.com/vba-NothingEmpty.html

  4. #4
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Quote Originally Posted by orange View Post
    GraemeG, Be cautious with x = NULL

    The syntax is along these lines
    if IsNull(fieldname)......

    See this link for an explanation of NULL Empty etc.
    http://allenbrowne.com/vba-NothingEmpty.html
    thanks - I know the about the If isnull and use it alot in my code.
    But this is terms of:
    Code:
    Private Sub txtComAreaDecorationRenewYear_AfterUpdate()
    If IsNull(txtComAreaDecorationRenewYear.Value) Then
        Me.[txtComAreaDecorationRenewYear] = ""
    ElseIf Me.[txtComAreaDecorationRenewYear] < Format(Date, "yyyy") Then
        MsgBox "Renew Year Invalid:  < Current Year!"
        Me.txtComAreaDecorationRenewYear = Null
    ElseIf CLng(Me.[txtComAreaDecorationRenewYear] > CLng(Format(Date, "yyyy") + 5)) Then
        MsgBox "Renew Year Invalid:  Exceeds Life Expectancy!"
        Me.txtComAreaDecorationRenewYear = Null
    End If
    Me.txtComAreaDecorationRenewYear.BackColor = vbWhite
    End Sub

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

Similar Threads

  1. Current Record Update Issue
    By SALPBE in forum Programming
    Replies: 0
    Last Post: 02-23-2011, 03:02 PM
  2. Different passwords on front-end & back-end?
    By Delta223 in forum Access
    Replies: 3
    Last Post: 01-07-2011, 09:25 AM
  3. Lock back-end DB with VBA
    By somm in forum Programming
    Replies: 5
    Last Post: 12-31-2010, 01:38 AM
  4. Update Query Performance Issue
    By Amber_1977 in forum Queries
    Replies: 2
    Last Post: 12-07-2010, 08:36 AM
  5. Back up database
    By sdondeti in forum Access
    Replies: 15
    Last Post: 11-03-2009, 02:17 PM

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