What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » HELP: Downloading MS Access file in VB6 App using INET control

HELP: Downloading MS Access file in VB6 App using INET control
Author: Message:
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. HELP: Downloading MS Access file in VB6 App using INET control
I guys,

I hope someone can help me with my recent problem.

I'm trying to download a Microsoft Access from the net in my Visual Basic 6 application. I'm using the INET control.

I've previously used this method to download a basic text document and it worked fine. So i wanted to download a MS Access document and thought i'd just modify the URL that it downloads from. But this didn't work. The Access document created is not a recognised Access document. Access won't open it neither will the Visual Basic 8 ADODC connect to the downloaded access document. both say it is not a recognised Access document.

Below is the Visual Baisc 6 code used when loading the form that is to download the file.
code:
ProgressBar1.Max = 281
    Inet1.RequestTimeout = Timeout 'set timeout
    Destination = <path to which access document will be save> 'set destination file
    Inet1.Execute "<URL from which the access database will be downloaded>", "GET" 'Start the download of the specified file

This is the code that is executed when the status of the Inet control is changed:
code:
Static inProc As Boolean
    If Not inProc Then 'only execute this procedure, if it is the first call (DoEvents in this sub may call this event frequently
        inProc = True
        Debug.Print Timer, State
        Select Case State
            Case icResponseReceived 'Received something
                Dim vtData() As Byte 'Current Chunk
               
                Do While Inet1.StillExecuting
                    DoEvents
                Loop
                Do
                    DoEvents
                    vtData = Inet1.GetChunk(256, 1)
                    If UBound(vtData) = -1 Then Exit Do 'exit loop, if no Chunk could received
                    ReDim Preserve file(SafeUBoundFile + UBound(vtData) + 1) 'enlarge file-array
                    CopyMemory file(UBound(file) - UBound(vtData)), vtData(0), UBound(vtData) + 1 'copy received Chunk to the file-array
                    If UBound(vtData) <> 255 Then Exit Do 'if the length of the chunk is not 255, then it must be the last chunk of the file
                   
                    Dim tmp As Long
                    tmp = UBound(file) / 1024
                    If tmp > ProgressBar1.Max Then tmp = ProgressBar1.Max 'if KBs is higher then ProgressBar1.Max then truncated
                        ProgressBar1.Value = tmp 'update ProgressBar1
                Loop
               
                Inet1.Cancel
           
                Open Destination For Binary As #1 'Write file-array to destination-file
                Put #1, , file
                'Close #1
                Erase file 'free file-array
                'inProc = False
               
                FrmUpdate.Show
                Unload Me
               
        End Select
        inProc = False

    End If

Sorry if there is quite an obvious solution, but i haven't been programming for long and have tried many thing last night without success.

Thanks in advance
RileyM
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
06-02-2005 01:35 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-02-2005 at 01:35 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by RaceProUK on 06-02-2005 at 01:51 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-02-2005 at 01:54 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Hah on 06-03-2005 at 12:59 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-03-2005 at 01:13 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Mike on 06-03-2005 at 02:01 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-03-2005 at 02:26 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Mike on 06-03-2005 at 02:49 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-03-2005 at 03:00 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-03-2005 at 03:17 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Hah on 06-03-2005 at 02:58 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Hah on 06-03-2005 at 03:14 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Hah on 06-03-2005 at 03:27 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-03-2005 at 03:32 PM
RE: HELP: Downloading MS Access file in VB6 App using INET control - by Hah on 06-03-2005 at 07:12 PM
RE: RE: HELP: Downloading MS Access file in VB6 App using INET control - by Salem on 06-05-2005 at 11:06 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On