Printer Error...Newbie Help
I am trying to build a component that prints a list of orders. I got the code to compile and registered the DLL, but when I run the code, I get a generic 'Printer Error' message. I tried the MS Knowledge base, but no luck.
I have very little experience in VB. In fact, this is my first component. I'm pretty handy in ASP, so I thought it wouldn't be much of a stretch to go from ASP to VB.
I want it to print to the default printer and I do not need a print preview dialog box. I basically want the user to click a button and have this thing start spitting out the orders on the printer.
ok, onto the code. I can post the whole project code if you need it. This is the class it is calling on the ASP page
Code:
Public Sub PrintPackingSlip(ByVal iVendorID)
'Print Packing Slip for Vendor
' Declare my Database vars to be used in the this sub
Dim rs As Recordset
Dim sqlTxt As String
Dim strHTML As String
'Query
sqlTxt = theQuery
'Check if Connection is open
Call CheckDBConn
'Execute the SQl Statement
Set rs = DE1.MYDB.Execute(sqlTxt)
'Begin Loop through RS
Do While Not rs.EOF
'Create HTML
strHTML = rs("order_id")
'Print Text to Page
Printer.Print strHTML
'End Page
Printer.EndDoc
'New Page
Printer.NewPage
'Move to Next Record
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
Here is the ASP code to run it.
Code:
Set objVendor = Server.CreateObject("Vendor.VendorPrint")
objVendor.PrintPackingSlip(1) ' 1 is the vendorID
Set objVendor = Nothing
This is my first post here, so I hope I'm posting in the right place.