GillinghamFC
Programmer
I need to create a live link direct into a table from a web based application. It works o.k in Excel. I can insert data into access but I can't create a live link? Any ideas?
Private Function GetDDEBridge()
Channel1 = DDEInitiate("BDDE", "TKR"
' Set up error handle
On Error Resume Next
' FX
Dim MyDB As Database
Set MyDB = CurrentDb()
Dim Table1 As Recordset
Set Table1 = MyDB.OpenRecordset("DDETest"
Table1.LockEdits = True
Table1.Edit
' £/$
Table1("GBPUSD" = Trim(DDERequest(Channel1, "$$GBPUSD/ls")
Table1("GBPUSDDChg" = Trim(DDERequest(Channel1, "$$GBPUSD/dac")
Table1("GBPUSDPChg" = Trim(DDERequest(Channel1, "$$GBPUSD/dpc")
' $/£
Table1("USDGBP" = Trim(DDERequest(Channel1, "$$USDGBP/ls")
Table1("USDGBPDChg" = Trim(DDERequest(Channel1, "$$USDGBP/dac")
Table1("USDGBPPChg" = Trim(DDERequest(Channel1, "$$USDGBP/dpc")
' £/EUR
Table1("GBPEUR" = Trim(DDERequest(Channel1, "$$GBPEUR/ls")
Table1("GBPEURDChg" = Trim(DDERequest(Channel1, "$$GBPEUR/dac")
Table1("GBPEURPChg" = Trim(DDERequest(Channel1, "$$GBPEUR/dpc")
' EUR / $
Table1("EURGBP" = Trim(DDERequest(Channel1, "$$EURGBP/ls")
Table1("EURGBPDChg" = Trim(DDERequest(Channel1, "$$EURGBP/dac")
Table1("EURGBPPChg" = Trim(DDERequest(Channel1, "$$EURGBP/dpc")
Table1.Update
Table1.LockEdits = False
Table1.Close
Set Table1 = Nothing
' IPE Brent Crude
Dim Table2 As Recordset
Set Table2 = MyDB.OpenRecordset("Brent_Reuters"
Table2.LockEdits = True
Table2.Edit
' Front Month
Table2("Brent1Bid" = Trim(DDERequest(Channel1, "@IB.1/bid")
Table2("Brent1Ask" = Trim(DDERequest(Channel1, "@IB.1/ask")
Table2("Brent1Hi" = Trim(DDERequest(Channel1, "@IB.1/hi")
Table2("Brent1Lo" = Trim(DDERequest(Channel1, "@IB.1/lo")
Table2("Brent1Chg" = Trim(DDERequest(Channel1, "@IB.1/dac")
Table2("Brent1PChg" = Trim(DDERequest(Channel1, "@IB.1/dpc")
' Front 2nd Month
Table2("Brent2Bid" = Trim(DDERequest(Channel1, "@IB02M/bid")
Table2("Brent2Ask" = Trim(DDERequest(Channel1, "@IB02M/ask")
Table2("Brent2Hi" = Trim(DDERequest(Channel1, "@IB02M/hi")
Table2("Brent2Lo" = Trim(DDERequest(Channel1, "@IB02M/lo")
Table2("Brent2Chg" = Trim(DDERequest(Channel1, "@IB02M/dac")
Table2("Brent2PChg" = Trim(DDERequest(Channel1, "@IB02M/dpc")
Table2.Update
Table2.LockEdits = False
Table2.Close
Set Table2 = Nothing
' IPE Gas Oil
Dim Table3 As Recordset
Set Table3 = MyDB.OpenRecordset("GasOil_Reuters"
Table3.LockEdits = True
Table3.Edit
' Front Month
Table3("GasOil1Bid" = Trim(DDERequest(Channel1, "@IP.1/bid")
Table3("GasOil1Ask" = Trim(DDERequest(Channel1, "@IP.1/ask")
Table3("GasOil1Hi" = Trim(DDERequest(Channel1, "@IP.1/hi")
Table3("GasOil1Lo" = Trim(DDERequest(Channel1, "@IP.1/lo")
Table3("GasOil1Chg" = Trim(DDERequest(Channel1, "@IP.1/dac")
Table3("GasOil1PChg" = Trim(DDERequest(Channel1, "@IP.1/dpc")
' Front 2nd Month
Table3("GasOil2Bid" = Trim(DDERequest(Channel1, "@IP02M/bid")
Table3("GasOil2Ask" = Trim(DDERequest(Channel1, "@IP02M/ask")
Table3("GasOil2Hi" = Trim(DDERequest(Channel1, "@IP02M/hi")
Table3("GasOil2Lo" = Trim(DDERequest(Channel1, "@IP02M/lo")
Table3("GasOil2Chg" = Trim(DDERequest(Channel1, "@IP02M/dac")
Table3("GasOil2PChg" = Trim(DDERequest(Channel1, "@IP02M/dpc")
Table3.Update
Table3.LockEdits = False
Table3.Close
' if error display message
If Err Then
Err = 0
' Display error information.
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If
DDETerminateAll
End Function
Private Function GetDDEBridge()
Channel1 = DDEInitiate("BDDE", "TKR"
' Set up error handle
On Error Resume Next
' FX
Dim MyDB As Database
Set MyDB = CurrentDb()
Dim Table1 As Recordset
Set Table1 = MyDB.OpenRecordset("DDETest"
Table1.LockEdits = True
Table1.Edit
' £/$
Table1("GBPUSD" = Trim(DDERequest(Channel1, "$$GBPUSD/ls")
Table1("GBPUSDDChg" = Trim(DDERequest(Channel1, "$$GBPUSD/dac")
Table1("GBPUSDPChg" = Trim(DDERequest(Channel1, "$$GBPUSD/dpc")
' $/£
Table1("USDGBP" = Trim(DDERequest(Channel1, "$$USDGBP/ls")
Table1("USDGBPDChg" = Trim(DDERequest(Channel1, "$$USDGBP/dac")
Table1("USDGBPPChg" = Trim(DDERequest(Channel1, "$$USDGBP/dpc")
' £/EUR
Table1("GBPEUR" = Trim(DDERequest(Channel1, "$$GBPEUR/ls")
Table1("GBPEURDChg" = Trim(DDERequest(Channel1, "$$GBPEUR/dac")
Table1("GBPEURPChg" = Trim(DDERequest(Channel1, "$$GBPEUR/dpc")
' EUR / $
Table1("EURGBP" = Trim(DDERequest(Channel1, "$$EURGBP/ls")
Table1("EURGBPDChg" = Trim(DDERequest(Channel1, "$$EURGBP/dac")
Table1("EURGBPPChg" = Trim(DDERequest(Channel1, "$$EURGBP/dpc")
Table1.Update
Table1.LockEdits = False
Table1.Close
Set Table1 = Nothing
' IPE Brent Crude
Dim Table2 As Recordset
Set Table2 = MyDB.OpenRecordset("Brent_Reuters"
Table2.LockEdits = True
Table2.Edit
' Front Month
Table2("Brent1Bid" = Trim(DDERequest(Channel1, "@IB.1/bid")
Table2("Brent1Ask" = Trim(DDERequest(Channel1, "@IB.1/ask")
Table2("Brent1Hi" = Trim(DDERequest(Channel1, "@IB.1/hi")
Table2("Brent1Lo" = Trim(DDERequest(Channel1, "@IB.1/lo")
Table2("Brent1Chg" = Trim(DDERequest(Channel1, "@IB.1/dac")
Table2("Brent1PChg" = Trim(DDERequest(Channel1, "@IB.1/dpc")
' Front 2nd Month
Table2("Brent2Bid" = Trim(DDERequest(Channel1, "@IB02M/bid")
Table2("Brent2Ask" = Trim(DDERequest(Channel1, "@IB02M/ask")
Table2("Brent2Hi" = Trim(DDERequest(Channel1, "@IB02M/hi")
Table2("Brent2Lo" = Trim(DDERequest(Channel1, "@IB02M/lo")
Table2("Brent2Chg" = Trim(DDERequest(Channel1, "@IB02M/dac")
Table2("Brent2PChg" = Trim(DDERequest(Channel1, "@IB02M/dpc")
Table2.Update
Table2.LockEdits = False
Table2.Close
Set Table2 = Nothing
' IPE Gas Oil
Dim Table3 As Recordset
Set Table3 = MyDB.OpenRecordset("GasOil_Reuters"
Table3.LockEdits = True
Table3.Edit
' Front Month
Table3("GasOil1Bid" = Trim(DDERequest(Channel1, "@IP.1/bid")
Table3("GasOil1Ask" = Trim(DDERequest(Channel1, "@IP.1/ask")
Table3("GasOil1Hi" = Trim(DDERequest(Channel1, "@IP.1/hi")
Table3("GasOil1Lo" = Trim(DDERequest(Channel1, "@IP.1/lo")
Table3("GasOil1Chg" = Trim(DDERequest(Channel1, "@IP.1/dac")
Table3("GasOil1PChg" = Trim(DDERequest(Channel1, "@IP.1/dpc")
' Front 2nd Month
Table3("GasOil2Bid" = Trim(DDERequest(Channel1, "@IP02M/bid")
Table3("GasOil2Ask" = Trim(DDERequest(Channel1, "@IP02M/ask")
Table3("GasOil2Hi" = Trim(DDERequest(Channel1, "@IP02M/hi")
Table3("GasOil2Lo" = Trim(DDERequest(Channel1, "@IP02M/lo")
Table3("GasOil2Chg" = Trim(DDERequest(Channel1, "@IP02M/dac")
Table3("GasOil2PChg" = Trim(DDERequest(Channel1, "@IP02M/dpc")
Table3.Update
Table3.LockEdits = False
Table3.Close
' if error display message
If Err Then
Err = 0
' Display error information.
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If
DDETerminateAll
End Function