Currently my users download a database outside my app then from within it they can add the database to their main database. Now I want to have the app download and add the database all at once.
If I change the file extension to .txt the code below downloads the database as a text file but saves it as a mdb.
Dim strURL As String
Dim bData() As Byte ' Data variable
Dim intFile As Integer ' FreeFile variable
strURL = "http://www.asite/update1.txt"
intFile = FreeFile()
bData() = Inet1.OpenURL(strURL, icByteArray)
Open App.Path & "\update1.mdb" For Binary Access Write As #intFile
Put #intFile, , bData()
Close #intFile
But how can I check that the file exists on my site?
If the file doesn't exist, i.e. I haven't added the update to my site yet, the code still creates an update1.mdb that is really a text file that starts:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>The page cannot be found</TITLE>