"Lyle Fairfield" <ly***********@ aim.com> wrote in
news:11******** **************@ i39g2000cwa.goo glegroups.com:
I can think of no reason you can't run the ""exact"" code. The file is
there.
Writing Data will take a little longer. Maybe tomorrow.
We can write the data to a local file and upload it all with ADO only.
Sub RecordsetOnHttp ()
Dim r As ADODB.Recordset
Set r = New ADODB.Recordset
With r
.Open "http://ffdba.com/ffdbaAccounts.x ml", , adOpenKeyset,
adLockBatchOpti mistic
While Not .EOF
Debug.Print .Collect(1)
.MoveNext
Wend
.AddNew Array(1, 2, 3), Array(Format(No w, "yyyymmddhhnnss "), Null,
False)
If DoesFileExist19 97("ffdbaAccoun ts.xml") Then Kill
"ffdbaAccounts. xml"
.Save "ffdbaAccounts. xml", adPersistXML
End With
UploadFile "ffdbaAccounts. xml", "ffdbaAccounts. xml", "http://ffdba.com",
"UserName", "PassWord"
End Sub
Public Sub UploadFile( _
ByVal FromPath As String, _
ByVal ToFile As String, _
ByVal Server As String, _
Optional ByVal UserName As String, _
Optional ByVal PassWord As String)
Dim r As ADODB.Record
Dim s As ADODB.Stream
Set r = New ADODB.Record
Set s = New ADODB.Stream
r.Open Server & "/" & ToFile, , adModeWrite, adCreateOverwri te, ,
UserName, PassWord
With s
.Open r, , adOpenStreamFro mRecord
.Type = adTypeBinary
.LoadFromFile FromPath
.Close
End With
r.Close
End Sub
Public Function DoesFileExist19 97(ByVal FilePath As String) As Boolean
Const FileNotFoundErr Number As Long = 53
On Error GoTo DoesFileExist19 97Err
GetAttr FilePath
DoesFileExist19 97 = True
DoesFileExist19 97Exit:
Exit Function
DoesFileExist19 97Err:
With Err
If .Number <> FileNotFoundErr Number Then
MsgBox .Description, vbCritical, "Error Number: " & .Number
End If
End With
Resume DoesFileExist19 97Exit
End Function
I have added 3 records to the Recordset. It is quite interesting to see
how these are saved in the xml.
<snips>
<z:row AccountID='19' CommonName='Inc ome Tax' FormalDescripti on=''/>
<z:row AccountID='20' CommonName='Ter raware' FormalDescripti on=''
IncludeInSummar y='True'/>
<z:row AccountID='21' CommonName='Tem p'
FormalDescripti on='Temporary' IncludeInSummar y='True'/>
<rs:insert>
<z:row CommonName='New Name' IncludeInSummar y='False'
rs:forcenull='F ormalDescriptio n'/>
<z:row CommonName='200 60317211431' IncludeInSummar y='False'
rs:forcenull='F ormalDescriptio n'/>
<z:row CommonName='200 60317211440' IncludeInSummar y='False'
rs:forcenull='F ormalDescriptio n'/>
</rs:insert>
They are saved as inserts. If we (ever) retach this recordset to its
parent database and updatebatch it, these new records will be saved.
I do not know if my upload is redundant because the save could be made
directly to the http server.
I do not know if my file upload will work on a non-ms server.
But I do know that data can be accessed from, modified, added to, and
saved to an http server using only ADO. I have done it. The code is there
for you to see.
Yes, I know this is strictly flat file. Yes I know it’s not an mdb. Yes I
know that there is no simultaneous user safeguard whatever. BUT IT IS
DATA, IT IS ACCESSED WITH ADO, AND IT IS THROUGH HTTP.
Could I use and edit the recordset with a form? Sure, I could.
--
Lyle Fairfield