Code just won't work when it should!

geoffcodd

Registered User.
Local time
Today, 17:33
Joined
Aug 25, 2002
Messages
87
Hi there,

I have the following code

Code:
Option Compare Database
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
    (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
    ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Function Download()

Dim llRetVal As Long
Dim vCircuit
Dim vCircuit_ID As String
Dim strHTML1 As String
Dim strHTML2 As String
Dim strHTML3 As String
Dim strFile As String

Set vCircuit = CurrentDb().OpenRecordset("tblCircuits")

DoCmd.SetWarnings False

Do Until vCircuit.EOF

vCircuit_ID = vCircuit!Circuit_ID

strHTML1 = "http://clr.mcilink.com:8080/clr/048AA4F018FE811A05B902A12C20BA87_"
strHTML2 = "_P_S_Y_Y_Y_Y_Premise_Data.html"
strHTML3 = strHTML1 & vCircuit_ID & strHTML2

strFile = "C:\Documents and Settings\gcodd\Desktop\F&E\Circuit_Info.txt"

    llRetVal = URLDownloadToFile(0, strHTML3, strFile, 0, 0)
    
    llRetVal = URLDownloadToFile(0, "http://clr.mcilink.com:8080/clr/048AA4F018FE811A05B902A12C20BA87_W0J62918_P_S_Y_Y_Y_Y_Premise_Data.html", "C:\Documents and Settings\gcodd\Desktop\F&E\Circuit_Info.txt", 0, 0)

The problem I have is that this works fine

Code:
llRetVal = URLDownloadToFile(0, "http://clr.mcilink.com:8080/clr/048AA4F018FE811A05B902A12C20BA87_W0J62918_P_S_Y_Y_Y_Y_Premise_Data.html", "C:\Documents and Settings\gcodd\Desktop\F&E\Circuit_Info.txt", 0, 0)

But this doesn't

Code:
llRetVal = URLDownloadToFile(0, strHTML3, strFile, 0, 0)

there doesn't seem to be any logic to why it doesn't.

Hope someone out there can shed some light

Thanks
Geoff
 
Code:
W0J62918_P_S_Y_Y_  Y_Y_Premise_Data.html
                  ^


How does it work with 2 spaces in your link?

Additionally, you may want to set your recordset to the first record.
(post your whole loop next time)
 
not only that, make sure your table is your recordset is getting records.
 

Users who are viewing this thread

Back
Top Bottom