Currency converter

markusa

New member
Local time
Today, 06:55
Joined
Sep 27, 2012
Messages
1
Hi,

I have two tables. 1 is the monthly average currency exchange rate ->€ :
IDYearMonthCountryExchRateExchCode120121AUD - Australian Dollar1,2405AUD220122AUD - Australian Dollar1,2367AUD

The other represents our spend:
FBL1N_ReportPostedonAmountinlocalcurLCurr7.5.20127 622,00INR

I need help wo convert the line item amount to Eur?

Help please:banghead:
 
I'm not sure of your requirement nor your environment, however, I did respond to a question about getting exchange rates from an internet site ad using them with access.
I have 2003.

Here is some code you may find useful, and I did post a database (mdb 2003) with an example.

I have created some vba code to get exchange rates from the European Central Bank.
I have spent a couple of hours trying to learn enough xmlhttp and DomDocument to simplify coding.
Here is latest effort which you could adapt to your needs I'm sure.

Jack
Code:
'---------------------------------------------------------------------------------------
' Procedure : LeeExchangeRate
' Author    : Jack
' Date      : 27-06-2012
' Purpose   : To get the daily exchange rates from the European Central Bank
'  at  http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
' These currency/rate pairs show the value of 1 euro in this related currency on this date
'
' From a learning view, this is sending an XMLHTTP request and getting a Response and
' using the DOMDocument amd related objects to extract the required data
' from the xml response. This approach seems cleaner and more consistent than using
' vba functions to search and parse strings within the response.
'---------------------------------------------------------------------------------------

' Last Modified:
'
' Inputs: N/A
' Dependency:
' **********This requires a reference to Microsoft XML, v6.0 **************
'--------------------------------------------------------------------------
'
Sub LeeExchangeRate()
   Dim Resp As New DOMDocument
   Dim Req As New XMLHTTP
   Dim objNodeList As IXMLDOMNodeList
   Dim objNode As IXMLDOMNode
   Dim objAttribute As IXMLDOMAttribute
   Dim mCurrency As String
   Dim mRate As String
   Dim x As Integer
   On Error GoTo LeeExchangeRate_Error

   Req.Open "GET", "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml", False
   Req.send
   Resp.loadXML Req.responseText

  ' uncomment the next line to see the response
  ' Debug.Print "XML Response is " & vbCrLf & "~~~~~~~~~~~~~~~~~" & vbCrLf & Req.responseText
   x = Resp.getElementsByTagName("Cube").Length
   Debug.Print "The number of <Cube nodes is   " & x

   '
   '  Get all Cube nodes.
   '

   Set objNodeList = Resp.getElementsByTagName("Cube")

   '
   '  For each cube node if it has attributes currency and rate then display the values.
   ' One Cube row has no attributes and one has only a time attribute.
   '

   For Each objNode In objNodeList
       If (objNode.Attributes.Length > 0) Then
       ' Get the "time" attribute for the date to which these exchange rates apply
           Set objAttribute = objNode.Attributes.getNamedItem("time")
           If (Not objAttribute Is Nothing) Then
               Debug.Print "Exchange Rates from European Central Bank   as at  " & objAttribute.text & vbCrLf _
               & vbCrLf & "**Read these as 1 euro = **" & vbCrLf
           End If
        ' Get the "currency" attribute
           Set objAttribute = objNode.Attributes.getNamedItem("currency")
           If (Not objAttribute Is Nothing) Then
               mCurrency = objAttribute.text
           End If
        ' Get the associated "rate" attribute
           Set objAttribute = objNode.Attributes.getNamedItem("rate")
           If (Not objAttribute Is Nothing) Then
               mRate = objAttribute.text
           End If
        'Put the data in my variables for display
           If mCurrency > " " And mRate > " " Then
           Debug.Print mCurrency & "  " & mRate
           End If
       End If
   Next objNode

   On Error GoTo 0
   Exit Sub

LeeExchangeRate_Error:

    MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure LeeExchangeRate of Module xmlhttp_etc"

End Sub

There is a database example at
http://www.4shared.com/office/qy66lj57/DarrenXchange.html
 

Users who are viewing this thread

Back
Top Bottom