Results 1 to 12 of 12
  1. #1
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8

    Question Form display different wording and font color if a field is active.

    I am totally new to Access/Programming in general. In fact this question is based on an assignment I have to complete. In fact it is the last assignment for the semester. So far I have scored all 100's on my assignments. I have picked up this vanilla version of Access fairly easily. But it is pretty basic. But this problem I cannot for the life of me figure out what to do. I have tried multiple things and none seem to work. My current version has been the closest to being complete yet. But I am stumped. I need a label to change what it says depending on if the MemberID box is active or not.

    Active = Word1 Bold, and change font color
    Inactive= Word 2 Bold, and change font color.



    This is what I have so far.

    Code:
    Private Sub Form_Current()    'For when the MembershipStatus field is active, display the word current and the field value in magneta
        'For when the MembershipStatus field is not active display the word review and the field value in blue
            If MemberID.Value = "Active" Then
                MemberID.ForeColor = FF00FF
                Me.lblCurrentMsg.Caption = "Current"
            Else
                MemberID.ForeColor = 16711680
                Me.lblCurrentMsg.Caption = "Review"
          End If
    End Sub
    Thanks for any and all assistance.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,740
    You mention
    MembershipStatus field
    but you're testing
    If MemberID.Value = "Active"
    ??

    Do you get an error message??

  3. #3
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8
    I corrected the comment thanks for pointing that out. When I was reworking it I did some sloppy coding. Below is the correct info as it currently stands. I think the issue could possibly be with If
    MemberID.Value = "Active" Then
    . Brain is fried. I am enjoying learning this material though. Also I tried saving it as a mdb and it would not let me. All of our work is done in accdb, we are required to use Access 2010.



    Private Sub Form_Current() 'For when the MemberID field is active, display the word current and the field value in magneta
    'For when the MemberID field is not active display the word review and the field value in blue
    If MemberID.Value = "Active" Then
    lblCurrentMsg.ForeColor = FF00FF
    Me.lblCurrentMsg.Caption = "Current"
    Else
    lblCurrentMsg.ForeColor = 16711680
    Me.lblCurrentMsg.Caption = "Review"
    End If
    End Sub

  4. #4
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8

    Post

    I tried this and I get a compile error.

    Code:
    If Me.MemberID.active = "true" Then
         Me.lblCurrentMsg.ForeColor = FF00FF
         Me.lblCurrentMsg.Caption = "Current"
    Else
         Me.lblCurrentMsg.ForeColor = 16711680
          Me.lblCurrentMsg.Caption = "Review"
    End If

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,740
    MemberId sounds like it should be a number.
    Can you recheck the assignment info and confirm exactly which field could contain "Active"?

  6. #6
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8
    Ok, so since you said that I realized I made a boneheaded mistake. There is an entirely separate field labeled MembershipStatus. I really need to take my time doing this stuff. So now it works. Only problem is when it switches to "current" the color is black and not magenta. I wonder if the property settings have something to do with that?

    Code:
    Private Sub Form_Current()    'For when the MemberID field is active, display the word current and the field value in magneta
        'For when the MemberID field is not active display the word review and the field value in blue
            If MembershipStatus.Value = "Active" Then
                lblCurrentMsg.ForeColor = F433FF
                Me.lblCurrentMsg.Caption = "Current"
            Else
                lblCurrentMsg.ForeColor = 16711680
                Me.lblCurrentMsg.Caption = "Review"
          End If
    End Sub

  7. #7
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8
    I think it was because when I think of a field as being active I think that is actually selected and active.

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,740

  9. #9
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8

    Re: Form display different wording and font color if a field is active.

    I will give that a go.

  10. #10
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8
    vb colors worked!! Learned something new there. Literally I have like 2 hours experience with VB haha. Now just hunting down the bold option. You have been a tremendous help orange! I look forward to learning more on this forum, my contact with vb, access and other languages is just beginning.

  11. #11
    Subizzle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Posts
    8
    All done and submitted, thanks again orange.

  12. #12
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,740

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

Similar Threads

  1. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 09:14 PM
  2. Change font color in subform
    By rtrinidad in forum Forms
    Replies: 1
    Last Post: 11-04-2012, 01:42 PM
  3. Formatting Font/Color Query Results
    By jcbuche in forum Queries
    Replies: 7
    Last Post: 03-08-2012, 02:53 PM
  4. Change as per condition font color
    By miziri in forum Programming
    Replies: 1
    Last Post: 08-20-2009, 04:23 AM
  5. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 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