Results 1 to 8 of 8
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    text boxes turning black

    this is a new occurrence on a single format form that has worked well for years
    (falls into the: "what did I do now?" and "how do I fix it?" categories

    on the form there are a couple of text boxes that require a narrative input by the user. as an assist to remind themselves if they need to come back to it for one reason or another, next to them i added a toggle button to change the back color of the textbox from what ever its 'normal' color is (white...) to a a note pad yellow, and then back again.

    suddenly (or at least i just noticed), when clicked to turn notepad yellow, it instead turns completely black. if you navigate from that record and back, it won't be black anymore, but it won't be notepad yellow; it will be a puke gaslight green. If is already gaslight green, when you click to return to white, again it turns black; and if you navigate away and then back, it will be white.
    If you continue to click the toggle without the advance and return, the color remains black.

    totally befuddled (but with much appreciation in advance)

    here's the code:

    Code:
    Const NormalColor As Long = -2147483643
    Const FlagColor As Long = 9434579
    
    
    Private Sub tglCatalogNoModFlag_AfterUpdate()
        If Nz(Me.tglCatalogNoModFlag, 0) = 0 Then
            Me.txtCatalogNoMod.BackColor = NormalColor
        Else
            Me.txtCatalogNoMod.BackColor = FlagColor
        End If
    End Sub


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    try
    .backcolor = vbWhite

    or vbBlack

    (make sure .transparent = false )

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    the backcolor is actually a shade of light grey (company's color palette) NTL i tried .backcolor = vbWhite; the problem persists
    backstyles are normal (vs. transparent)

    BTW if vbWhite did work, it still wouldn't explain the gaslight green that is showing up.

    ALSO, just noticed: it's happening to all of the 'controls' that i have a flip-the color toggle, but not in one instance where i have a toggle on the main form to flip the backcolor of the detail section of a subforman

    ALSO, tried deleting the control and adding a new one in its place; this did not fix the problem

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,404
    Try this: Starting Backcolor. #000000 is BLACK which was probably that problem.

    Click image for larger version. 

Name:	formprop.png 
Views:	21 
Size:	12.1 KB 
ID:	43464

    Code:
    Option Compare DatabaseOption Explicit
    Const NormalColor As Long = &HFFFFFF
    Const FlagColor As Long = &H7EC8ED
    
    
    
    
    Private Sub tglCatalogNoModFlag_AfterUpdate()
        If Nz(Me.tglCatalogNoModFlag, 0) = 0 Then
            Me.txtCatalogNoMod.BackColor = NormalColor
        Else
            Me.txtCatalogNoMod.BackColor = FlagColor
        End If
    End Sub
    Last edited by davegri; 11-17-2020 at 06:53 PM. Reason: addl clarif

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    huge thnx
    the problem turned out to be much simpler (as a mentor of mine always said: "when all else fails, check the obvious")
    (the constants were missing in the parent form, but found in the sub ... don't know, not asking)
    (BTW, didn't need to start BackColor: black)

    NTL
    if I could ask for direction (my web search is dead-ending)

    ...in access VBA, i see color defined as integer (9434879), with a '#' (#BA1419), and also '&' (&HFFFFFF)
    what's the difference ?

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    You can also use the RGB() for colors in access
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,404
    ...in access VBA, i see color defined as integer (9434879), with a '#' (#BA1419), and also '&' (&HFFFFFF)
    what's the difference ?
    It's different base numbering systems.
    9434879 decimal is equivalent to 8FF6FF hexadecimal

    BA1419 hexadecimal is equivalent to 12194841 decimal

    Access allows you to specify hexadecimal notation (depending on usage) in the example as #8FF6FF or &H8FF6FF

    The Hex numbers are always expressed as 6 digits counting from the right, corresponding to R,G,B components of the color with 2 digits for each in succession. In the example, 8F for red, F6 for green and FF for Blue
    However, RGB notation can't take Hex arguments, it requires decimal so you need to convert 8F, F6 and FF respectively to decimal to get RGB(143,246,255).
    A further complication is that sometimes you need to swap the R and B arguments to get the correct color. Yes, it's a mess.

    See this for helpful info: https://www.binaryhexconverter.com/d...-hex-converter
    Last edited by davegri; 11-18-2020 at 11:12 AM. Reason: clarification? Is that possible?

  8. #8
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    well the word is full of mess: there's good mess and bad mess. Let's just call this on a REAL mess.

    thnx yet again,
    m.

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

Similar Threads

  1. Text boxes filled with black when focused
    By milton837 in forum Forms
    Replies: 7
    Last Post: 09-08-2019, 02:36 PM
  2. Check Boxes turning blue
    By jhatcheqb in forum Database Design
    Replies: 3
    Last Post: 09-08-2014, 01:11 PM
  3. Replies: 1
    Last Post: 03-29-2012, 12:20 AM
  4. Report printing black boxes
    By stephenaa5 in forum Reports
    Replies: 1
    Last Post: 05-11-2011, 04:53 PM
  5. Replies: 1
    Last Post: 07-30-2009, 12:54 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