Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21839

Table is empty after writing to it

$
0
0
Hi

I have trouble writing to a table after clearing it. I print the table to a .doc file which is totally empty when I open it.
My code is:
Dim SQLquery As String
Dim db As DAO.Database
Set db = DBEngine.OpenDatabase(backendlink)
Dim Plotdata As DAO.Recordset
db.Execute "DELETE * FROM Plotdata"
Set Plotdata = db.OpenRecordset("Plotdata", dbOpenDynaset, dbAppendOnly)

Plotdata.AddNew
Plotdata!Command = "{\rtf1\ansi\deff0{\fonttbl{\f0 Verdana;}}"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\landscape"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\paperw" & Round(29.7 * twips, 0) & "\paperh" & Round(21 * twips, 0) & "\margl" & 1 * twips & "\margr" & 1 * twips & "\margt" & Round(2.5 * twips) & "\margb" & 1 * twips
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\fs18"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "Hængerdokumentation"
Plotdata!Command = Plotdata!Command & " genereret den " & Date & " " & Time & "\line"
Plotdata.Update

Dim filehandle As Integer
filehandle = FreeFile

Filnavn = "C:\RAMCATS\test.doc"

Open Filnavn For Output As #filehandle

Plotdata.MoveFirst
Do Until Plotdata.EOF

cmd = Plotdata!Command
Print #filehandle, cmd
Plotdata.MoveNext
Loop


I would expect to see the word "Hængerdokumentation" and the date and time stamp... but the document is completely empty.

Best regards

Viewing all articles
Browse latest Browse all 21839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>