RSS Forums RSS

Downloading an mdb file using INET

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Thread Solved
Reply
Posts: 10
Reputation: No Pain No Gain is an unknown quantity at this point 
Solved Threads: 0
No Pain No Gain No Pain No Gain is offline Offline
Newbie Poster

Downloading an mdb file using INET

  #1  
Jan 10th, 2009
The code below downloads the test.mdb file but when I try to open it MS Access says it is in an unrecognised format.

Is it not possible to use Inet for downloading an Access database?

Dim strURL As String
Dim bData() As Byte ' Data variable
Dim intFile As Integer ' FreeFile variable

strURL = "http://www.asite/test.mdb"
intFile = FreeFile()
bData() = Inet1.OpenURL(strURL, icByteArray)
Open App.Path & "\test.mdb" For Binary Access Write As #intFile
Put #intFile, , bData()
Close #intFile
AddThis Social Bookmark Button
Reply With Quote  
Posts: 2,404
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 209
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Downloading an mdb file using INET

  #2  
Jan 10th, 2009
Are you sure that the database is in the same format (ie, did you make the database in Access 2007, and are opening it in 2003?)
Reply With Quote  
Posts: 10
Reputation: No Pain No Gain is an unknown quantity at this point 
Solved Threads: 0
No Pain No Gain No Pain No Gain is offline Offline
Newbie Poster

Re: Downloading an mdb file using INET

  #3  
Jan 10th, 2009
Good idea but made in 2000 and trying to open it in 2000
Reply With Quote  
Posts: 2,404
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 209
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Downloading an mdb file using INET

  #4  
Jan 10th, 2009
Mkay, have you tried opening the original (open it with wordpad or notepad, unless it's huge) and then opening the one downloaded through VB, and see if they are the same size and the same basic byte structure etc? And there is no DB on http://www.asite.com for me to check it myself
Last edited by Comatose : Jan 10th, 2009 at 4:15 pm.
Reply With Quote  
Posts: 10
Reputation: No Pain No Gain is an unknown quantity at this point 
Solved Threads: 0
No Pain No Gain No Pain No Gain is offline Offline
Newbie Poster

Re: Downloading an mdb file using INET

  #5  
Jan 10th, 2009
Your previous post made me wonder if the database I was using was corrupt. So I just grabbed another, checked it would open OK, posted it to a website, downloaded it OK, but Access doesn't recognise it.
Reply With Quote  
Posts: 2,404
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 209
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Downloading an mdb file using INET

  #6  
Jan 10th, 2009
weird...are the file sizes the same and all that?
Reply With Quote  
Posts: 10
Reputation: No Pain No Gain is an unknown quantity at this point 
Solved Threads: 0
No Pain No Gain No Pain No Gain is offline Offline
Newbie Poster

Re: Downloading an mdb file using INET

  #7  
Jan 10th, 2009
Just tried open both in Notepad.

Original is gobblydegook

Dowloaded one is bigger and a text file about a missing file
Reply With Quote  
Posts: 2,404
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 209
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Downloading an mdb file using INET

  #8  
Jan 10th, 2009
the gobblydegook is fine, that means it's in access format... if the other opens some kind of weird text, then obviously access won't read it.... now the question is, what is this text about missing files?
Reply With Quote  
Posts: 10
Reputation: No Pain No Gain is an unknown quantity at this point 
Solved Threads: 0
No Pain No Gain No Pain No Gain is offline Offline
Newbie Poster

Re: Downloading an mdb file using INET

  #9  
Jan 10th, 2009
Just posted a simple text file 1.txt with one word in. Changed the app.path to c:\.1.txt

The text file downloads fine and I can open it and see the word. If I alter the two .txt to .mdb and download the database I can still download it but part of what I find in Notepad is this:

"The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.mdb' may be incorrect.   Please review the URL below and make sure that it is spelled correctly."

It seems to be something to do with Access.

I have to go now will let you know tomorrow if I sort it.

Thanks for your help.
Reply With Quote  
Posts: 2,404
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 209
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Downloading an mdb file using INET

  #10  
Jan 10th, 2009
The web server is forbidding the web browser from accessing .mdb files... makes sense for security reasons. On the server, rename the .mdb file to something like "mydatabase.zip" and when you have downloaded the file, have vb rename it to something like "mydatabase.mdb"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Views: 853 | Replies: 10 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:19 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC