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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animate a label 3

Status
Not open for further replies.

SuePee

Technical User
Jun 10, 2003
47
US
We use the database across many departments and users. Some are regulars and some only use the database occasionally. The problem is ... When one of the occasional users has to enter data he/she sometimes writes over another's data. I have placed a command button to click to get a blank record. But some don't notice it. So I placed a Red Label next to the command button saying "Click this to add new record" But what I would really like to do is to get it to flash or scroll the words or jump up and slap some fingers, something like that. Does anyone know how to do this?

Thanks

SuePee [witch]
 
It sounds like what you really need is more control over your database. Use as front page that allows people to select either creating a new record, or editing an existing one. If they select the new record, open the form with DataEntry = Yes. If they wish to edit records set AllowAdditions = No.

Don't trust the user to pay attention, make them pay attention.

Sean.
 
In the form's timer event you can use this:

Private Sub Form_Timer()

Dim textlen As Integer, textstr As String
Dim strfield As Variant
Static astr As Integer
strfield = "" & "YourText" & " " & "YourText" & " " & "" 'Change your text to what you want the label to say
textlen = Len(strfield)
astr = astr + 1
If astr >= textlen Then astr = 1
textstr = Mid([strfield], astr, Len([strfield])) & " " & Left([strfield], astr)
Me.YourLabelName.Caption = textstr 'change "YourLabelName to the name of your label
End Sub

I can't remember where I first saw this code probably The Access Web, but it works great for a visual effect.

HTH,
Eric

 
Eric,

I typed in the code exactly as you said, but it did nothing, not even an error message. I had a label all set up with the text already on it (label50). So i deleted the label and made a new one and change the code to (label52) and it still didn't work. Does the label have to have a control source or can it be just a text box?

What did I do wrong? [sadeyes]

SuePee
 
Just a thought. You need to set the timer interval property in your form's property to something other than zero.

Eric
 
Eric

Here is what I typed in. I changed the time interval to '3' but I got an error message that said I did not identify 'astr'Please help. whine, whine.

Sue

Private Sub Form_Timer()
Dim textlen As Integer, textstr As String
Dim strfield As Variant
strfield = "" & "Click Here for New Record" & " " & "Click Here for New Record" & " " & ""
textlen = Len(strfield)
astr = astr + 1
If astr >= textlen Then astr = 1
textstr = Mid([strfield], astr, Len([strfield])) & "" & Left([strfield], astr)
Me.Label52.Caption = textstr
End Sub
 
Sue...a timer interval of 3 will show nothing.....you need a timer interval such as 250 or something....1000 = 1 second

****************************
Computers are possibly the most un-intelligent things ever invented, yet we let them control the world. Possibly a reflection of our own stupidity.

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Sorry. I didn't declare a variable.

Try this:

Private Sub Form_Timer()
Dim textlen As Integer, textstr As String
Dim strfield As Variant
Dim astr as integer
strfield = "" & "Click Here for New Record" & " " & "Click Here for New Record" & " " & ""
textlen = Len(strfield)
astr = astr + 1
If astr >= textlen Then astr = 1
textstr = Mid([strfield], astr, Len([strfield])) & "" & Left([strfield], astr)
Me.Label52.Caption = textstr
End Sub

Also the timer interval value is based on 1/100 of a second. So if you use 3 as your timer interval the routine is run every .03 seconds. That can use a lot of processing and make you app look like it is flashing for lack of a better word. I this instance I would recommend setting it to 250 or so.
 
Robert is right. I should have said 1/1000 of a second.
 
Thank you all! I got it to work! I am so proud and happy!
Really, I am new to this stuff and self taught. All of the folks on this site have provided invaluable info to me over the past 6 months.

Thank you, thank you

[wavey2]
 
Here's a star for luceze's code. It works nicely and the effects are simple. Also, here's a star for perryman's suggestion because it really is a very appropriate way to handle data entry.

Paul
 
Paul, Sean,

My database is very large and I have many, many forms on it. I use the switchboard and have several pages on that. I have, in the past, used two forms to add and edit. But after a while there gets to be just too much for the switchboard to handle. The solution from Eric worked wonderfully and I thank all of you for your input.

Thanks

SuePee
 
SuePee, no explanation necessary. I felt both solutions were worth acknowledging but didn't mean to imply that you should have done anything differently.

Paul
 
SuePee,

Then don't use two different forms, only use one. Have the button selected open the form and set the DataEntry and AllowAdditions properties. This way, you can use the same form. The same idea applies to query criteria's for various uses.

You may have to ditch the switchboard to get code to run behind a button. I don't work with switchboard because they are too limited in what they can do. Perhaps someone could point us both to a usefull switchboard that isn't limited on the number of buttons and adding your own VBA behind it.

I simply use a FrontPage form and put all the cmdButtons I want with all the coding needed.

Sean.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top