Software

Bring Access forms to life with animation

Publishing your Access forms on the Web? Add some fun with animated images! Here's how to create a form that will appear to come to life when you run it.

Publishing your Access forms on the Web? Add some fun with animated images! For example, say you want to publish a form that allows your users to enter a keyword that will search your software catalog for winter specials; to illustrate this, you've embedded an image of two boys hitting the a puck with their hockey sticks. To animate the image, follow these steps:

  1. Open your form in Design view.
  2. Right-click the embedded image of the hockey players.
  3. Click Properties.
  4. Click the All tab.
  5. Click in the Name Property box and enter ctlImage.
  6. Double-click the Form Properties button in the top left-hand corner of the form window.
  7. Click the Timer Interval property box and enter 200.
  8. Click in the On Timer property box and click the Build button.
  9. Select Event Procedure and click OK.
  10. Enter the following code at the prompt:

On Error GoTo HandleError

ctlImage.Left = ctlImage.Left + 200

ctlImage.Top = ctlImage.Top + 100

ExitHere:

Exit Sub

HandleError:

ctlImage.Left = 0

ctlImage.Top = 800

Resume ExitHere

  1. Click [Alt]Q.

When you subsequently run the form, the boys will appear to skate across the form.

Miss an Access tip?

Check out the Microsoft Access archive, and catch up on other Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

19 comments
robpparker
robpparker

Not what I think is high on the list of priorities for Access tips. If you need inspiration, try tips that answer the commonly-asked questions in the microsoft.public.access.* newsgroups. I don't recall anybody ever asking how to do this, but there's lots of things that are commonly asked for. And, in my opinion, is pretty much WOFTAM to trivialise a professional database front-end design application with tips such as this. Rob

Trilogy
Trilogy

I really appreciate the Access tips, all of them! I am a volunteer in a church-based organization creating simple Access apps to automate a number of functions. Not being a pro, they help a lot!

Merlirin
Merlirin

I wonder if i missed something (or if it works different in 2007). I pasted in the graphic, copied the code, but the image seems to move in a diagonal from the left uppper corner to the lower right corner (and then seems to disapear off to nothingness for a little bit). Note - I copied and pasted the info & did not rely on my bad typing. I did notice when I removed the +100 from the ctlImage.Top = ctlImage.Top code, I was able to see it "skate" across the top of the page, but it seemed to move down a half inch or so the 2nd time it cycled through the form (and stayed in that position after that point. It did "run into" my form fields at that point also. Changing the error handler top code from 800 to 0 solved that problem. Overall, a fun thing to add to a form.

bearrabbit
bearrabbit

Love animation thnx and keep it coming

JRL21
JRL21

Cool, thanks. that was useful. Hope the customer isn't too distracted, though it'll make quite an impression because I've never seen this done in Access.

library assistant
library assistant

Your tip caught my eye because of the animation. Looks like you should be able to use just about any graphic there too. I have been collecting all your access tips for when I got around to learning access. Looks like I don't have any more excuses. :)

atindra41
atindra41

Mary Ann Richardson, Thank you very much for the life-saving tips that you make available from time to time. Very obliged.

ron_r_a
ron_r_a

If you saw an application that animated hockey players and you have no Access db in need of that, you saw WOFTAM. If you saw the potential of animating a form to increase its value or bring attention to a part of the form, this tip has served its purpose. A picture is worth a thousand words. But what if one picture is not enough to convey an idea or a trend. Maybe an animation will fit the need perfectly. It got your attention long enough to view the article.

ssharkins
ssharkins

That's a little harsh. Priorities: We don't have a list of prioritized solutions/problems on this blog. Ideas come from our own experiences and readers. They all matter. Requests: We do respond to reader requests, although you will seldom see the requests on the blog. I don't know where MA got the inspiration for this tip, but after reading other responses, it's a clear hit. Generally, the readers love MA's techniques. I disagree with her occasionally, but that's the nature of the business. The readers love her, so I'd like to invite you to visit us again and review more of her work. I'm hopeful that you will be pleasantly surprised. Trivialities: A lot of readers aren't professional developers. They are just trying to get their work done. If Office (Access in this case) can support something, an entry on it doesn't trivialize a thing. We're just sharing information. No one finds every entry useful though -- that would be an impossible goal. But what one finds trivial another may find quite helpful. HAPPY NEW YEAR to you just the same! I guess I must be terribly out of the loop; can someone tell me what WOFTAM means?

ssharkins
ssharkins

I really appreciate the time you took to check in with us. This blog does get a lot of traffic, and I'm grateful for that -- but it's always good to get feedback. First, it helps us fine-tune the type of tips we post. Second, well... it just feels good. Thanks!

Tony Hopkinson
Tony Hopkinson

Well it may not be flippin. :p As a tip and an exercise, animating is OK. For an inhouse app WOFTAM sums it up nicely. I'm always suspicious of this sort of fluff in an application. Makes me wonder what got sacrificed on the priority list, to give the marketing monkeys something to point and hoot at.

ssharkins
ssharkins

Well, I'm officially in the loop now. Thanks!

ssharkins
ssharkins

It's Okay to stir things up. :)

Jaqui
Jaqui

never. I want the data presented quickly, for efficiency, not slowed down by bloated garbage like animations. note: I do not use access, ever. if it don't run natively on *nix, it isn't professional quality software.

Tony Hopkinson
Tony Hopkinson

The only non fluff use I can see for animations, is an attention grabber for the market. This get's old quick and there should be an option to turn them off, or as a something is happening indicator, when it's impractical or misleading to use a progress bar.

robpparker
robpparker

WOFTAM - Waste OF Time And Money :-) There are other variations in which the F stands for an additional word - one of which has already been posted earlier. Rob

robpparker
robpparker

Well, I guess it's obvious from my initial post, that I certainly never have, and almost equally as certain never will, include it in any Access application of mine. I say "almost certainly", because if the customer wants it badly enough - and is prepared to pay well enough - I would do it :-) I would, however, try to talk them out of it beforehand. And to slightly change a recent comment from an answer I posted to a m.p.a.* newsgroup, "The customer is (nearly) always right." Rob PS. I seem to have caused a stir - it was not my intention; it was simply that I thought for a professional forum such as Tech Republic, the content of that particular column was rather "soft".

ssharkins
ssharkins

I'm not suggesting that people add animation to their forms, but I don't decide what other people find useful. I do agree with you that as a learning exercise, the technique might be quite useful. Personally, I've never animated anything, nor would I recommend someone do so just because they can. There are lots of Access (Office) features I never use. But, let's put it out there for the readers -- have any of you ever used animation in a production database and if so, was it truly necessary as a custom solution or just fluff? My guess is we'll get little to no response. :)

Editor's Picks