This was created as a response to a question by forum member Gismo at Access World Forums
He wanted code to display live Forex (currency exchange) rates in a ticker tape format on an Access form.
I suggested 4 possible approaches:
1. Use scrolling marquee text – see my Attention Seeking example app.
As for the data, you would need to find a site which gives an XML or JSON output.
This would then need to be imported and parsed to update the display at set intervals of your choice. Potentially complex to do.
2. Use an ActiveX web browser control linked to a site containing this code as an HTML snippet. This has the advantage of being updated automatically.
3. Add a currency exchange ticker widget to your own website using freely available code online. You would then use your webpage in the web browser control.
4. Use my Currency Exchange Rate Tracker app as an alternative approach
CERT Version 1.43
Click to download: Currency Ticker LIVE v1.2 (zipped)
This example uses the idea outlined in point 3 above.
There are a number of websites offering free HTML widget code for currency exchange rates. First of all I tried the forexrealtime.com site but the HTML script suppled didn’t work for me. However, various HTML scripts available from exchangerates.org.uk worked perfectly. That ticker is more customisable in terms of width, speed & colours. It also indicates up/down trends. For example:
The Exchange Rates site also has other types of live currency widget scripts including a working forex example - but I prefer this one.
The HTML script used in the widget is:
<iframe src="//www.exchangerates.org.uk/widget/ER-LRTICKER.php?w=600&s=2&mc=GBP&mbg=F0F0F0&bs=yes&bc =000044&f=verdana&fs=10px&fc=000044&lc=000044&lhc= FE9A00&vc=FE9A00&vcu=008000&vcd=FF0000&" width="600" height="30" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe>
Next I decided to make a working application based on this.
The app references another page on this website where I've removed all other menu items to keep things simple.
The full web address for that page is: http://www.mendipdatasystems.co.uk/live-currency-rates/4594448258
<!-- EXCHANGERATES.ORG.UK LIVE FOREX RATES TABLE START -->
<div style="width:178px;margin:0;padding:0;border:1px solid #cbcbcb;background:#fff;">
<div style="width:178px;text-align:center;padding:2px 0px;vertical-align:middle;color:#003366;font-family:arial;font-size:11px;font-weight:bold;">
Live Exchange Rates
var tz = '0';
var mc = 'GBP';
var nb = '10';
var c1 = 'USD';
var c2 = 'EUR';
var c3 = 'AUD';
var c4 = 'JPY';
var c5 = 'INR';
var c6 = 'CAD';
var c7 = 'ZAR';
var c8 = 'NZD';
var c9 = 'SGD';
var c10 = 'CNY';
var bc = 'Base Currency';
var lc = '003366';
var bdrc = 'cbcbcb';
<div style="width:178px;text-align:center;padding:2px 0px;vertical-align:middle;color:#003366;font-family:arial;font-size:10px;font-weight:bold;">Real Time Rates by <a rel="nofollow" style="color:#003366;text-decoration:none;font-family:arial;font-size:10px;" href="//www.exchangerates.org.uk" target="_new">ExchangeRates.org.uk</a></div>
<!-- EXCHANGERATES.ORG.UK LIVE FOREX RATES TABLE END -->
The HTML code used in this widget is:
A thumbnail screenshot of the application is shown below. Click the screenshot to view a larger version
At first I kept getting script errors at startup. To fix that, I had to add a cookie control on the specified webpage.
Click to accept & it will disappear in the usual way.
NOTE: If you still get a script error (possibly two) just click Yes twice
The same principle can be used with other live HTML scripts e.g. share prices / sports results / news updates.
If you can find a suitable script just adapt the widget on the website.
It would be even better to be able to load the HTML script & run it direct in Access without referencing a web page. I haven't looked into this as yet
For an alternative approach, see the Currency Exchange Rate Tracker application