Saturday, April 24, 2010

Access: Add a webslice to a webcontrol

In this post i'll show you how to add a webslice to a webcontrol in Access 2010. I got the idea watching the video from Albert Kallal. He created a webdatabase called "Room Bookers". You can view a demo here: http://www.members.shaw.ca/MrTurtle/2010d1/w1.html

Now one of the features i liked was the fact that he imlpemented a webcontrol showing the weather in a certain place. That's what i wanted to try. So here we go.

Add the webcontrol to the form
First create an empty db with one form. On this form add a webcontrol which you can find in the ribbon under controls:


After you click the webcontrol on the form you'll be prompted to enter the hyperlink or webaddress. In this case i added the webaddress from Bing. The webcontrol got filled with the complete website and that's not what i wanted. I just wanted the little piece showing me the weather. So how did Albert do this? I took a second look and paused his video right at the point where he showed the weather part. Now i see it! He's using a webslice instead of a whole website. Ok so it's of to the webslice creater.

Create a webslice
Now how do you create a webslice? First it's of to Internet Explorer. Then I searched with Bing for weather and got several results. The first on is the most interesting because it has a special feature.

When you hover your mouse over the first part of the website a little green box appears around a square block which appears around the first feature on the site. Great this is what's called a webslice! So go ahead and create a webslice from this bly clicking on that green icon on the upper left corner. You'll see the following dialog appear:


Now for ease of use i added it to the favorites bar.. so i can check if it's really there.


and it is! Now all i have to do is copy the url from this webslice and paste in into my own webcontrol used in the database.

As you can see I added the webslice address to the address of the [Insert Hyperlink] dialog and clicked OK. Now let's see if this worked on my form.


and it did, wow this is a great feature! I removed the borders to give it a nice looking effect otherwise you will see those scrollbars etc. So i set the scrollbars to [No].

What No Issues?
I wish i could say that i had no issues but i did. The webslice frequent loses it's connection appearently because i've also seen the following image as well: it's in Dutch but it states:
[This function is temporarily not available. Try again later]

Yes, we have to stay honest here it's no always sunny but we have to give this technique a change. I'll look into the web for other nice webslices i can find and post them back here. If you have or know about any cool webslices let me know.








1 comment:

  1. Anonymous1:37 AM

    Hiya Maurice,

    I had a go with adding a webslice to a database and don't get the problem of it failing after a little while. However, I do get another problem. Using the bing weather webslice you suggested, it gets confused as to where I am. It initially works out that I am in the UK and sets my location to London. I changed that to Mattishall Norfolk. However when I use a webslice in my form, it goes back to thinking that I am in London. When I click on the "Wearther in London, Greater London" hyperlink which comes up, it opens up Internet Explorer with details for Mattishall!

    Alan

    ReplyDelete