Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Flashing Text    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Flashing Text
Paul Evans 
    
5 years ago
Can anybody please help me. I have used the following sub routine which works exactly as I want it to. However I want to use this sub routine as a copy on other fields besides VehicleMake. I have tried copy and paste and altered the field name but this does not  work.

Private Sub Form_Timer()
      If Me.FilterOn = True Then
      If VehicleMake.BorderColor = vbBlack Then
           VehicleMake.BorderColor = vbRed
           VehicleMake.ForeColor = vbRed
        Else
           VehicleMake.BorderColor = vbBlack
           VehicleMake.ForeColor = vbBlack
    End If
       End If
End Sub

Thank you.
Richard Rost  @Reply  
           
5 years ago
It should work fine for any text box.
Paul Evans OP  @Reply  
    
5 years ago
If I use copy and paste which, (for example is WhereSeen) BOTH fields flash. I only want the field I have selected to flash. Where is my VBA code wrong?
Richard Rost  @Reply  
           
5 years ago
How are you selecting the field? Are you using a combo box with a list of field names in it? Or do you mean the field that has focus?
Paul Evans OP  @Reply  
    
5 years ago
I am selecting the field with the following sub-routine:-

Private Sub btnWhereSeenSearch_Click()
    Dim S As String
    S = InputBox("Enter Where Seen", "Where Seen Search Box", "")
    If S = "" Then Exit Sub
    Me.Filter = "WhereSeen Like ""*" & S & "*"""
    Me.FilterOn = True
End Sub
Richard Rost  @Reply  
           
5 years ago
If that's the case, then ALL of the fields will have values that match your criteria. Are you talking about the currently selected RECORD?
Paul Evans OP  @Reply  
    
5 years ago
I have 8 fields on my form each with their own unique search button to trigger each search (As above Search Sub-routine). This works correctly on all of the fields. (The above Timer Sub-routine) also works correctly on the field VehicleMake, but if I copy and paste into this routine and alter VehicleMake to WhereSeen BOTH fields flash. I do not want this to happen, I only want the field I have searched on. I want to use both of the Sub-routines on all of the fields (by altering text field names for each field).
Richard Rost  @Reply  
           
5 years ago
Then you'll need to make a variable (or another field) to store the name of which field you're searching on. Use that in your code to determine which field to make flash.
Paul Evans OP  @Reply  
    
5 years ago
This is far too complicated for me to understand. I need some sort of example to show me what you mean, or I shall have to give in.
Richard Rost  @Reply  
           
5 years ago
I'll add it to the list.
Adam Schwanz  @Reply  
           
5 years ago
If I'm understanding right, just make an unbound text field on the form. Say its called SearchColor. On you're search buttons on click event, do SearchColor="SearchFieldNameYouClickedHere", then just need to grab that in your timer.

Private Sub Form_Timer()
      Dim X As String
      X = SearchColor
      If Me.FilterOn = True Then
      If X.BorderColor = vbBlack Then
           X.BorderColor = vbRed
           X.ForeColor = vbRed
        Else
           X.BorderColor = vbBlack
           X.ForeColor = vbBlack
    End If
       End If
End Sub
Adam Schwanz  @Reply  
           
5 years ago
Upon testing, it appears that wont work. Same idea but need to change if statement. This may be the overcomplicated way
If X = "SearchFieldName" Then
SearchFieldName.BorderColor = vbRed
ElseIf X = "OtherFieldName" Then
OtherFieldName.BorderColor = vbRed
etc
Richard Rost  @Reply  
           
5 years ago
There ya go. That's what I was suggesting. :)
Juan C Rivera  @Reply  
            
5 years ago
Richard, this is a super example of how you take time from a busy day to take care of someone.  To this I have to say CUDOS.

V/r
Juan
Paul Evans OP  @Reply  
    
5 years ago
First of all I would like to thank Richard and Adam for their efforts in trying to help me. However, I still don't fully understand Adam's
solution. I would be obliged if this example was written out in full.
Adam Schwanz  @Reply  
           
5 years ago
I'll try to explain how I would do it a little more clearly, otherwise I'll leave it to Richard's videos. Will take a few posts.
You say you have 8 search buttons, for my example I'm going to call the 2 of my buttons used in my examples VehicleSearchButton and YearSearchButton and their 2 respective flashing fields are going to be VehicleSearchField and YearSearchField You will need to take my names and rename them accordingly to your fields.

Start with the Unbound Text field, put a text field on the form and I'll name mine SearchFieldName
You can set Visible No so it won't be around on your form.
Adam Schwanz  @Reply  
           
5 years ago
Go through and add this line SearchFieldName="VehicleSearchButton" to all of your search buttons On Click Events, replacing VehicleSearchButton with the respective Buttons Name, this will let us know which button was pressed, and it will store it in our unbound field SearchNameField.

Now we know which button was pressed, we just need to add it to our timer event.
Adam Schwanz  @Reply  
           
5 years ago
Private Sub Form_Timer()
      Dim X As String
      X = SearchFieldName
      If Me.FilterOn = True Then
      If X = "VehicleSearchButton" Then
           If VehicleSearchField.BorderColor = vbBlack Then
               VehicleSearchField.BorderColor = vbRed
               VehicleSearchField.ForeColor = vbRed
           Else
              VehicleSearchField.BorderColor = vbBlack
              VehicleSearchField.ForeColor = vbBlack
            End If
      ElseIf X = "YearSearchButton" Then
           If YearSearchField.BorderColor = vbBlack Then
           YearSearchField.BorderColor =vbRed
           YearSearchField.ForeColor = vbRed
           Else
           YearSearchField.BorderColor = vbBlack
           YearSearchField.ForeColor = vbBlack
           End If
   End If
End If
End Sub
Adam Schwanz  @Reply  
           
5 years ago
Continue to add all 8 of your buttons in this fashion. An ElseIf X = for each one. Hopefully I didn't typo anything was little difficult keeping it in the character limits. Hope this helps!
Richard Rost  @Reply  
           
5 years ago
Nice job, Adam. Above and beyond!
Juan C Rivera  @Reply  
            
5 years ago
Promote ASAP!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Flashing Text.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/8/2026 12:10:27 AM. PLT: 0s