Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OutputTo in Module Not Working!

Status
Not open for further replies.

roxannep

Technical User
Jun 20, 2000
69
0
0
I have set up a module to run "OnClick" from a form button. In putting in the DoCmd.OutputTo line, I keep getting errors telling me that I don't have an Object Type listed. Since I am trying to export the string as it is and there is no form or report that it attachs to, I must be missing something?

Private Sub CmdButton_Click()
Dim db As Database, rst As Recordset
Dim a As Integer, HTMLCode As String

Set db = CurrentDb()
Set rst = db.OpenRecordset("qryHTMLRecords")

rst.MoveLast
rst.MoveFirst

For a = 1 To rst.RecordCount
' Infomation could also change here
HTMLCode = Chr$(60) & "img src" & Chr$(61) & Chr$(34)
HTMLCode = HTMLCode & " HTMLCode = HTMLCode & rst![FileNo] & ".jpg" & Chr$(34) & Chr$(62)

DoCmd.OutputTo acOutputQuery, "qryHTMLRecords", acFormatRTF
rst.MoveNext
Next
DoCmd.Close

End Sub
 
I believe the problem is that the object that you output must be a table or a query stored in your mdb file, but your qryHTMLRecords is in fact a recordset object, and you can't do an OutputTo of a recordset.

HTH

Julio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top