Results 1 to 7 of 7
  1. #1
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78

    Enable text box and changing backcolor

    Hi,
    I m struggling to change the back color of a textbox.I want the color to turn on to red when the quantity will reach 10.This is the code i use
    Private Sub Texte15_Change()
    If Me.Texte15.Value < 10 Then
    Me.Texte15.Enabled = True
    Me.Texte15.Text = "Red"


    Me.Texte15.BackColor = vbRed
    End If

    i m using a combo box to autofill the texte15 but while checking the color of text15 does not change to red and the texte15 is still enable.

    Can anyone help me to find a solution at it

    Regards

  2. #2
    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 update/change events for the textbox won't fire if you set the value in code. You'd want this code in the after update event of the combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    It still does not do no effect,even when i place the code in the after update of the Combo

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    It does not work,can not upload the db,can i send by mails

  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
    deleted for privacy
    Last edited by pbaldy; 04-21-2016 at 11:27 AM.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Is this what you want? You'd have to add an Else clause to handle values >=10.

    Code:
    Private Sub Modifiable13_AfterUpdate()
    
        Me.prixvenduO.Value = Me.Modifiable13.Column(2)
        Me.Texte15.Value = Me.Modifiable13.Column(3)
    
    
        If Me.Texte15.Value < 10 Then
            Me.Texte15.Enabled = True
            Me.Texte15.BackColor = vbRed
        End If
    End Sub
    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: 4
    Last Post: 03-05-2013, 09:03 AM
  2. BackColor
    By trog in forum Forms
    Replies: 4
    Last Post: 07-24-2012, 11:51 AM
  3. If/Else If help to Change BackColor
    By SpdRacerX in forum Access
    Replies: 2
    Last Post: 03-20-2012, 10:09 AM
  4. Enable Field off Text Box
    By SpdRacerX in forum Forms
    Replies: 5
    Last Post: 03-13-2012, 01:48 PM
  5. Replies: 3
    Last Post: 08-11-2009, 10:40 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