Robert Gracie
Subscriptions at servicexp.com
Tue Jul 6 18:44:39 CDT 2004
Thank You Marty !!
Robert Gracie
www.servicexp.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of MartyConnelly
Sent: Monday, July 05, 2004 10:10 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Auto-Update FE Over the Internet?
Well you can download the FrontEnd mdb via XMLHTTP, Inet or URLMON.DLL.
Choose your poison.
After that it is just manipulating as a disk file.
Oh yes you can also use winHTTP object on Win98 and up
This gives you finer control in a class
http://www.mvps.org/emorcillo/vb6/inet/adl.shtml
Download files asynchronously with URLMON.DLL
or --------------
3. Add a MS Inet control to the form (Inet1)
4. Add a textbox (Text1)
5. Set the textbox Text property to
"http://images.ucomics.com/comics/ga/2003/ga030214.gif"
6. Add a command button (Command1)
7. In the Command1_Click event, add this code
Dim strURL As String
Dim bData() As Byte ' Data variable
Dim intFile As Integer ' FreeFile variable
Dim sFilename As String
strURL = Text1.Text
sFilename = "C:\Temp\" & Mid(Text1.Text, InStrRev(Text1.Text, "/") + 1)
intFile = FreeFile() ' Set intFile to an unused file.
' The result of the OpenURL method goes into the Byte
' array, and the Byte array is then saved to disk.
bData() = Inet1.OpenURL(strURL, icByteArray)
Open sFilename For Binary Access Write As #intFile
Put #intFile, , bData()
Close #intFile
or --------------
'This code fires off request to specified WEB page
'returns html, asp, xml, or text page in text string then sent to file
on disk
'Makes use of the XMLHTTPRequest object contained in msxml.dll.
'Check off Reference to MSXML Version 2.0 3.0
' I am using latest Version of IE5
' should also work with IE5.0 MSXML ver 2.0,2.6, 3.0 etc
'GrabTextFileFromWebSite
"http://www5.brinkster.com/mconnelly/GenericDB/Excel Redshift.zip"
Public Sub GrabTextFileFromWebSite(strMyURL As String)
'Dim oHttp As Object
Dim oHttp As New MSXML2.XMLHTTP40
Dim strFileName As String
Dim intfile As Integer
Dim bData() As Byte
'make use of the XMLHTTPRequest object contained in msxml.dll
' Set oHttp = CreateObject("MSXML2.XMLHTTP40")
'Set oHttp = GetObject("MSXML2.XMLHTTP30")
'oHttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
'oHttp.setRequestHeader "Content-Type", "text/xml"
'oHttp.setRequestHeader "Content-Type", "multipart/form-data"
oHttp.Open "GET", strMyURL, False
' stick in your web page above , file type can be anything asp txt
xml html etc.
'depends partially on content type
oHttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
oHttp.send
'check the feedback
Debug.Print "Ready State =" & oHttp.readyState
'normal state =4
Debug.Print "Status =" & oHttp.status
'normal status = 200
Debug.Print "Status Text =" & oHttp.statusText
' Debug.Print oHttp.getAllResponseHeaders()
'Debug.Print "Response Body =" & oHttp.responseBody
' Debug.Print "Response Body =" & StrConv(oHttp.responseBody, vbUnicode)
'Debug.Print "Response Text =" & oHttp.responseText
'Parse response text string here or send to file
'create directory structure if not in existance
' CreateDirectoryStruct ("c:\Accesshtmlstealer")
strFileName = "c:\Accesshtmlstealer\Amazon"
strFileName = strFileName & Format(Now, "yyyymmddhhmmss") & ".txt"
' WriteFile strFileName, oHttp.responseText
'Temporary storage
intfile = FreeFile()
' The file will be saved in the temp folder with the name download.zip'
Open "c:\temp\download.zip" For Binary Access Write As #intfile
'Put #intfile, , bData()
bData() = oHttp.responseBody
Put #intfile, , bData()
Close #intfile
'
Exit Sub
ErrorHandler:
MsgBox Err.Description & vbCrLf & Err.Number
'
Resume Next
End Sub
Robert Gracie wrote:
> Has anyone tried this?
>
>
>Robert Gracie
>www.servicexp.com
>
>
>
>
--
Marty Connelly
Victoria, B.C.
Canada
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com