Results 1 to 6 of 6
  1. #1
    ChairmanMetal is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    4

    Label Object Not Accepting VBA Settings


    My report includes the following code. No matter what I try, Painting_Label always has the grey back color. The Painting object is a checkbox, bound to a boolean in the data source table. I have replaced this report object by copying, pasting and modifying another object of the same type. I have replaced it by creating an entirely new object. I have changed to code to alter the label's border from Transparent to Solid if Painting = True -- and even with this change, the label's border is always solid. There are many, many other objects of this same type, with this same logic, on the report and all behave as programmed except for this one. Any help will be greatly appreciated.

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)


    lngGrey = RGB(224, 224, 224)
    lngWhite = RGB(255, 255, 255)

    Painting_Label.BackColor = lngWhite

    If Painting = True Then Painting_Label.BackColor = lngGrey

    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    did you try:

    Painting_Label.BackColor = vbWhite

    ALSO, the property of the label cannot be TRANSPARENT. it must be=NORMAL.
    then the RGB should work.


  3. #3
    ChairmanMetal is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    4

    Thank You

    Quote Originally Posted by ranman256 View Post
    did you try:
    Painting_Label.BackColor = vbWhite

    ALSO, the property of the label cannot be TRANSPARENT. it must be=NORMAL.
    then the RGB should work.
    The BackStyle for all labels on this report is Normal. I tried using vbWhite, but this made no difference. Thank you for responding, though.

  4. #4
    ChairmanMetal is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    4
    Interestingly, I tried to add .Value to the object name Painting in the statement If Painting = True Then Painting_Label.BackColor = lngGrey and intellisense did not recognize this and the compiler told me Invalid qualifier. I will try renaming the database field and changing all affected reports, etc.

  5. #5
    ChairmanMetal is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2020
    Posts
    4
    Renaming the database column solved the problem. I renamed the database column and all Data Source references to PaintingStuff and now everything works as expected. I could find no reference to Painting as an Access or VBA reserved word, but something behind the scenes is going on with that word.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The most comprehensive list I've seen (which does have Painting as a reserved word):

    http://allenbrowne.com/AppIssueBadWord.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 7
    Last Post: 10-06-2019, 07:37 AM
  2. query critera not accepting -- (two dashes)
    By tagteam in forum Access
    Replies: 3
    Last Post: 08-17-2016, 03:42 PM
  3. Format a Label Object in a report
    By louise in forum Reports
    Replies: 1
    Last Post: 07-09-2015, 07:01 AM
  4. Old database: Not accepting VBA Coding?
    By cfgrs in forum Access
    Replies: 11
    Last Post: 02-07-2013, 10:05 PM
  5. New Computer not accepting 5 digits
    By abie059 in forum Database Design
    Replies: 3
    Last Post: 01-10-2011, 10:02 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