help needed

X

xman_in

i have developed some functions in module using which i want to download CSV
files from a Stock exchange server. everything is fine but i am unable to
download CSV file, i get following msg "3011 The Microsoft Jet database
engine could not find the object
'http://www.nseindia.com/content/historical/EQUITIES/2007/SEP/'. Make sure
the object exists and that you spell its name and the path name correctly."
however when i check the values in debug windows everything is fine even the
file URL is constructed properly. for reference the code is
============================================
Option Explicit

Function ImportBhavCopy(dtFrom As Date, dtTo As Date)
On Error GoTo errHandler
Dim dtDate As Date

For dtDate = dtFrom To dtTo Step -1
'Debug.Print GetURL(dtDate)
DoCmd.TransferText acImportDelim, "", "Quotes", GetURL(dtDate), True, ""
Next

errHandler:
Debug.Print err.Number & " " & err.Description
Exit Function
End Function
Function GetURL(dtTemp As Date) As String
Dim strTemp As String
strTemp = "http://www.nseindia.com/content/historical/EQUITIES/"
strTemp = strTemp & GetYear(dtTemp) & "/"
strTemp = strTemp & UCase(GetMonthName(dtTemp)) & "/cm"
strTemp = strTemp & GetDay(dtTemp)
strTemp = strTemp & UCase(GetMonthName(dtTemp))
strTemp = strTemp & GetYear(dtTemp) & "bhav.csv"
GetURL = strTemp
End Function

Function GetMonthName(dtTemp As Date) As String
GetMonthName = MonthName(Month(dtTemp), True)
End Function
Function GetDay(dtTemp As Date) As String
If Day(dtTemp) < 10 Then
GetDay = "0" & CStr(Day(dtTemp))
Else
GetDay = CStr(Day(dtTemp))
End If
End Function

Function GetYear(dtTemp As Date) As String
GetYear = CStr(Year(dtTemp))
End Function

============================================

i will really appreciate if anyone can help me with this. i need this to be
completed as soon as possible. need to submit this for a project.
 
J

John Nurick

Hi,

Access doesn't use http. You'll need to download the csv files to a
location on your network before running TransferText.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top