Hi Robert,
However, I am using ACCESS 2000 and did not see the
OPTION COMPARE DATABASE. It asked me to select
to build an event macro, etc.
Okay, this means that you not have a check placed in an option that reads "Always use event
procedures". This option is found under Tools > Options on the Forms/Reports tab. If you place
a check in this option, then you will not be presented with the dialog that includes the
following three options:
Expression Builder
Macro Builder
Code Builder
A check in this option is the same as automatically selecting the Code Builder option. Your
choice....either leave this option unchecked and select code builder, or place a check in this
option and you won't be prompted again.
Once you open the code module behind a form, you should see Option Compare Database at the top of
the module. You may or may not see the next line of code, which reads Option Explicit. If you do
not see the very important Option Explicit, then click on this link to learn how to configure
your VB editor so that you will always get this line inserted on new modules:
http://www.access.qbuilt.com/html/gem_tips.html#VBEOptions
how do I identify the text box that I want to flash?
In form design view, click on View > Properties (if the properties dialog is not already
displayed). Then select the textbox in question with your mouse. You should see the name of the
textbox in the blue title bar of the properties dialog. I suggest using a descriptive name, such
as txtDate, for a date value or txtCountry for a country, etc. You really don't want a control by
the name of TEXT BOX 27. If you are reading the following VBA code, you likely wouldn't know
which text box on a form was being effected:
TEXT_BOX_27.BackColor = 255 ' Red or
TEXT_BOX_27.Enabled = False
I suggest that now is a good time to start using naming conventions. Good naming practices
include not using spaces in the names of any objects or controls. Here are some articles that you
can read on the subject:
Commonly used naming conventions
http://www.mvps.org/access/general/gen0012.htm
http://www.xoc.net/standards/default.asp
Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763
Reserved Words in Microsoft Access
http://support.microsoft.com/?id=286335
Tom
PS. You indicated that you are a retired Navy Chief. The father of a friend of mine is a
retired Captain of an attack class submarine. I find it very interesting to hear some of his
stories. If you send me a personal e-mail message, I will reply with his name. My e-mail address
is fairly easy to derive from this posting. Please do not post your real e-mail address to this
newsgroup.
____________________________________
Tom,
I opened the subform in design view; found the EVENT tab, set the Timer to
500 and then went to the ON TIMER and selected the event builder.
However, I am using ACCESS 2000 and did not see the OPTION COMPARE DATABASE.
it asked me to select to build an event macro, etc.
Should I do this? If so, how do I identify the text box that i want to
flash? Let's say it is TEXT BOX 27. Identify it as such in the name for the
text box?
____________________________________
2nd attempt to post. The first time I posted this message, it showed in my newsreader for less
than a minute. Then, it just disappeared, with a message that indicated that the message was too
old and could not be retrieved from the server! Sorry if anyone sees this message repeated in
their newsreader....
___________________________________________
Hi Robert,
I don't have any experience doing this, although I experimented a little and come up with
something that might work for you. Open your form in design view, then click on View >
Properties (if the properties dialog is not already open). Make sure the word "Form" is
displayed in the blue title bar of the properties dialog. Click on the Event tab. Set the Timer
Interval value to the number of milliseconds that you want--for example 500 ms to cause a flash
every half second. This event procedure is listed near the bottom of the list.
Then click into the event procedure directly above the Timer Interval, which is labeled On Timer.
Click the ellipses button (the button with the three dots). This should open the code module
associated with this form. You should see the following:
Option Compare Database
Option Explicit
Private Sub Form_Timer()
End Sub
Add the following code, so that you have something that looks like the following. Note: This
example is for a text box named "txtDate". You will need to use the appropriate name for your
text box:
Option Compare Database
Option Explicit
Dim blnFlag As Boolean
Private Sub Form_Timer()
If Me.ActiveControl = txtDate Or IsNull(Me.ActiveControl) Then
Select Case blnFlag
Case True
txtDate.BackColor = 255 ' Red
Case False
txtDate.BackColor = 16777215 ' White
End Select
End If
blnFlag = Not (blnFlag)
End Sub
Add an event procedure to make sure that the background color is reset to white when you tab out
of this textbox:
Private Sub txtDate_LostFocus()
txtDate.BackColor = 16777215 ' White
End Sub
Note: In the first line of code in the Form_Timer event procedure, I found that if I only had:
If Me.ActiveControl = txtDate Then
that the textbox would not flash when one navigated to a new (unsaved) record. So, I added the
check for IsNull. This causes the txtDate field to flash on a new record without regard to the
current control that has focus.
Tom
____________________________________
I wish to enhance a text box in a form of a database. Some data entry people
just don't read the signs. So if I can either add a flashing background to
the note or add the LAS VEGAS Lights effect, it may get people's attention.
Currently, I just added a background color of RED with black bold font.
However, that is boring. A flashing background such as you can choose via
WORD / Text Effects is what I would like to accomplish.
Anybody have experience in accomplishing this? Thank you,