Results 1 to 8 of 8
  1. #1
    SoreGums is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    10

    input fields stop being transparent...

    how do i get the the fields to be transparent all the time?



    I'm using the "put a txt box behind everything and use conditional formatting" to achieve the "highlight row" on continuous form method.

    Each time I click a row, the row is highlighted - awesome.
    then the field magically has a background colour even though it is set to be transparent - OK so i apply a conditional format (has focus, make bg color same as highlight) - awesome

    PROBLEM: Now i click onto something else and BAM! gets a new background color even though it was set to transparent...
    how do i solve this third instance of the input box having a background colour even though it is supposed to be transparent
    thanks

    Click image for larger version. 

Name:	ms.access_no.longer.transparent.png 
Views:	16 
Size:	38.6 KB 
ID:	19301

  2. #2
    SoreGums is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    10
    this obviously works...
    (removed the conditional formatting I created)
    Code:
    ' BEGIN FIX HIGHLIGHT ROW ISSUES
    Private Sub txtBoxNumber_GotFocus()
        txtBoxNumber.BackColor = RGB(251, 140, 60)
    End Sub
    Private Sub txtBoxNumber_LostFocus()
        txtBoxNumber.BackColor = RGB(251, 140, 60)
    End Sub
    
    
    Private Sub txtStatus_GotFocus()
        txtStatus.BackColor = RGB(251, 140, 60)
    End Sub
    Private Sub txtStatus_LostFocus()
        txtStatus.BackColor = RGB(251, 140, 60)
    End Sub
    
    
    Private Sub txtNotified_GotFocus()
        txtNotified.BackColor = RGB(251, 140, 60)
    End Sub
    Private Sub txtNotified_LostFocus()
        txtNotified.BackColor = RGB(251, 140, 60)
    End Sub
    
    
    Private Sub txtRecieved_GotFocus()
        txtRecieved.BackColor = RGB(251, 140, 60)
    End Sub
    Private Sub txtRecieved_LostFocus()
        txtRecieved.BackColor = RGB(251, 140, 60)
    End Sub
    
    
    Private Sub txtModified_GotFocus()
        txtModified.BackColor = RGB(251, 140, 60)
    End Sub
    Private Sub txtModified_LostFocus()
        txtModified.BackColor = RGB(251, 140, 60)
    End Sub
    ' END FIX HIGHLIGHT ROW ISSUES
    of course there is an issue with this...
    events fire out of order to achieve smoothness...
    control.GotFocus() happens before Form.Current()
    which means if I hold the mouse click on the other row, background color changes prematurely.

    Hope someone knows how to force controls to be transparents somehow - instead of having to hack around this, thanks

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I'm guessing the reason 69 members have read your post but not responded is that, like myself, they cannot understand exactly what you're trying to do, here. But in answer to your question "how to force controls to be transparent," the simple fact is that when a Control has Focus, its Back Style will revert to Normal, and I know of no way to change this behavior.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    SoreGums is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    10
    i had a feeling this was going to be the answer.

    control has focus, back style set as normal
    For clarity.

    1. create a continuous form
    2. want to click on a "row" and have that row highlighted
    3. achieving 2 is possible with this solution
    4. problem with 3 is that when a control has focus the back style is set to normal instead of keeping it's user defined value of transparent
    5. to overcome 4 put code in the focus events (unfortunately setting the back style to transparent doesn't work, so need to specify the same colour as the row highlighter colour)
    6. the side effect of doing 5 is that the control events fire before the form.current event, thus the control gets its bg colour before the highlight control gets its color from conditional formating

    I guess I could mitigate 6 if i also apply the bg colour to the highlighter control instead of waiting for conditional formatting - will give that a go.
    I could have simply skipped 4,5 & 6 if backstyle stayed defined - one of those "design choices" we encounter while working with other people's code i guess.

  5. #5
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Is the form in question used as a sub-form ?
    Are you using it to edit data or it is for display only ?

  6. #6
    SoreGums is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    10
    So I have a "Main" form which has two sub-forms, "List" (continuous form, highlight row, left) & "Item" (single record, show the thing highlighted, right)

    I did have my "List" as not editable, however I needed a couple of working inputs and didn't want to create a third sub-form called "Search" that would control the "List".

    To answer your question "List" is for display only - hence why I didn't want all the focus stuff.

  7. #7
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Not sure if this will work-
    Add a text box to the form, set its width to 0 and place it at the extreme left of the form (same left margin of the highlighter text box and this text box )and set its tab index to 0. Set the focus to this control in the exit and enter events of the sub form control on your main form.
    One more option is to use a list box for displaying the data. You can easily highlight a row in it.

  8. #8
    SoreGums is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    10
    hmm, deferring all focus and tab stopping to the skinny control on the far left might work - will give that a go tomorrow - thanks for the suggestion!
    (the only issue i forsee is no longer being able to select the text to copy it for some reason - not sure if that is really an issue though...)

    listbox isn't going to work as it is too much of hack and loose a bunch of other things, clever idea though

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

Similar Threads

  1. Can't make the Tab transparent
    By panoss in forum Forms
    Replies: 4
    Last Post: 11-06-2014, 09:33 AM
  2. Replies: 6
    Last Post: 02-12-2014, 05:16 PM
  3. Replies: 3
    Last Post: 07-25-2013, 07:20 AM
  4. Replies: 2
    Last Post: 07-24-2013, 12:35 PM
  5. .GoTo and .TypeText - Stops When Field is Empty
    By alpinegroove in forum Programming
    Replies: 5
    Last Post: 01-04-2012, 10:16 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