Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make a text in a form to blink 1

Status
Not open for further replies.

lebanoncedars

Programmer
Jul 17, 2002
43
CA
Hi there,
How can I make a "text" in a "WELCOME FORM" to blink, and then the form closes AFTER 5 SECONDS or certain time?
so the next main form opens right afterward.

Or make the text to blink for 5 seconds in "Welcome Form", stops then closes the form to open next main form ?

Thank you,
lebanoncedars@hotmail.com
Lebanoncedars
 
I tried this as a quick method and it worked. In my example the name of the form with the blinking control (a label) is called "frmBlink".

Set up 2 private variables in the form module.

Private strOnOff As String
Private intCount As Integer

In the form "Open" event, initialize the 2 variables.
strOnOff = "ON"
intCount = 0


In the form "On Timer" event, you need this code. Edit the name of the control to your control name. I called mine "lblBlink".

If strOnOff = "OFF" Then
Me!lblBlink.Visible = True
strOnOff = "ON"
intCount = intCount + 1
Else
Me!lblBlink.Visible = False
strOnOff = "OFF"
intCount = intCount + 1
End If
If intCount = 10 Then
DoCmd.Close acForm, "frmBlink", acSaveNo
End If

Set the form "Timer Interval" property to 1000 (you may need to play with this number).


in the form "Close" event, a command to open your main form.

DoCmd.OpenForm "frmMainForm"


Like I said. it is quick and dirty but it works.
 
HI Bob,
Thank you very much 4 UR fast reply.
Everything is set properly as you wrote down.
The "Label" blinks once and disapears and the form stays on the screen without going to the next.

The only thing I couldn't figure out right here:
-----------------
Set up 2 private variables in the form module.

Private strOnOff As String
Private intCount As Integer

In the form "Open" event, initialize the 2 variables.
strOnOff = "ON"
intCount = 0

-----------------
I need more details Please:
Where and How I need to setup the 2 variables ?
You said in the form module!
Thank you,
Lebanoncedars

 
HI Bob,
Can you pleaseclear out this code for me.
------------------
Set up 2 private variables in the form module.

Private strOnOff As String
Private intCount As Integer

In the form "Open" event, initialize the 2 variables.
strOnOff = "ON"
intCount = 0
-----------------
Thanks Million
Lebanoncedars
 
Open the form in design view.

In the menu bar at the top of the screen "File Edit View Insert etc", click on view. You should see "Code" in the option list.

Click on "Code". This will open up the form module. Scroll to the very top of the module. Right at the top you will see a line of code that reads "Option Compare Database".

Right under this is where you will declare the two variables. Paste in the two lines right below the line that reads "Option Compare Database".

This is what you should end up with right at the top of the module (a module is where you enter code that will run when form or control events happen).

Option Compare Database
Private strOnOff As String
Private intCount As Integer

Now that the two variables have been declared. They need to be initialized (or given a starting value). This should be done when the form opens ( in the form "Open" event).

Again, right at the top of the module, just above where the code starts, there are 2 selection drop down boxes. Click on the drop down on the box on the left and select "Form". Now click on the drop down box on the right and select "Open" from the list. As soon as you select "Open", your cursor will be in the code area of the form open event.

Right above the cursor, you will see this line of code - "Private Sub Form_Open(Cancel As Integer)". A little below it and you will see this lne of code "End Sub". Between these 2 lines see where you paste in the code to initialize the variables.

strOnOff = "ON"
intCount = 0

In my first reply, did you understand where to put the code for the form "On Timer" event and the form "On Close" event? Did you also understand how to set the form "Timer Interval" property?

If you get everything in the right place it will work fine.
 
Hi Bob,
I want to thank you very much for your time and effort you done so far, and I need to thank you again for been patient.
You are really one of the top programmer.
Thank you again, and your solution is working fine.
I know you run out of patience, but I'm not that expert like you.

Thanks Millions
Sincerely,
Lebanoncedars
 
Hi Boby,
If I have 2 "Forms" one for login and second for "Access Denied"..I need to force the user not to be able to login any more if he tries to login again after 3 times with wrong UserID or PW.
example : Like closing the application down.

Thank you,
Lebanoncedars
 
I need to know a little more information.

On the login form does the user key in his id and password, then click a command button?

Then you want the "Access Denied" form to pop and when he clicks Ok, shut down MS Access?
 
Hi Bob,
Yeh 3 Forms I did created :
- one "Form1" is "UserLogin Form".. User key in his ID and PW and OK button.. If his ID and PW correct then ..

- Next "Form2" popup and "txtAccess Granted" blinks and moved on to the main form.

- Third "form3" popup and "txtAccess denied" blinks, this is if user has the wrong ID and PW. This form closes automatically and goes back to login "Form1".

Up to this moment, all forms working normal and fine.
The question is:
I need the application to close down if the user tries to key in his ID and PW wrong more than 3 times.
or maybe create something much more strickly, so he cannot login anymore.

Sincerely,
Lebanoncedars
 
Again, just initialize a counter to 0 (zero) when the login form opens. Increment it when the user clicks the OK button. If the user gets the ID and PW right, send him straight to the main form. Why bother with a blinking access granted form.

If the user gets the ID or PW wrong, display a message box ( from within the Click event of the OK button) telling them to try again. Increment the counter. If they get get it wrong three times (using the counter to track attempts), display a message to contact the system administrator and exit the system. You don't want to keep legitimate users out of their system permamently just because they can't remember their login. Eventually they will remember it.

The access granted and denied forms are a waste of time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top