help needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
It generates the correct URL for me. You need to make sure that the dates you
are inputting are valid dates for NYSE (not weekend/holiday). I get a
different error than you 3654 Internal internet failure.
I've never tried using transfertext across the internet before though and
haven't found any samples doing it either.
I copied the code and copied and pasted the generated string into the
browser address bar and it works, so the string is generated fine.

James
 
the url string which is generated is correct however the transfer text
function gets is passed in complete string, i dont know why, even when i
enter the url created in the browser it worksfine, the problem is with the
transfertext function. its very confusing.
 
Have you seen an example (or documentation) which states that transfertext
works on a URL?

James
 

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

Back
Top