Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Inet (Internet Transfer) in Access 1

Status
Not open for further replies.

BrooksR

Programmer
Feb 24, 2001
98
0
6
US
Currently I'm using the Microsoft Internet Transfer Control (v6). The icon for Inet is on my form and I use it with code like:

Dim objInet As Object
Set objInet = Me!axinettran.Object
objInet.Protocol = icHTTP
strURL = " objInet.URL = strURL
strAnswer = objInet.OpenURL(objInet.URL, icString)

This works well, but I'd like to get away from the form and use just a code module. I've tried:

Dim objInet As Object
Set objInet = New InetCtlsObjects.Inet
objInet.Protocol = icHTTP
strURL = " objInet.URL = strURL
strAnswer = objInet.OpenURL(objInet.URL, icString)

The above code doesn't generate errors, but the strAnswer always comes back blank.

Anyone have any ideas?

Thanks,
Brooks
 
Hi Brooks,

i was trying to do a similar thing in vb the other day but using .Execute instead. It was really flaky. In the end i resorted to the below code, which generates a file on your local drive/server, which i then read back into a var. Strangely, it seems not only more reliable but much quicker as well...

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

Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long

lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function

I'd like to attribute this as it's not my code but i can't remember the site i got it from, if i find it again i'll post back

HTH

Andy
 
FIIIINALLLY!!
I have had major problems with the Internet Transfer Control, but this works great!
Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top