help needed

xman_in

New member
Local time
Today, 14:21
Joined
Oct 19, 2007
Messages
1
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.
 
A couple of things:
1. Copy and paste the value of strTemp (from the 'Immediate Window') in the Start\Run box. Check if the file opens okay. If not then resolve file reference.
2. Does this server allow your application to connect to it? - Should talk to your helpdesk/Network guys.
 

Users who are viewing this thread

Back
Top Bottom