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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Recordset

Status
Not open for further replies.

vbmorton

Technical User
Dec 27, 2004
44
US
Can someone help.. I like to print data from a recordset,
i so far have this, but keep getting an error when i run it, saying invalid property.


rsDrawList.Open strsql,g_Conn,adOpenDynamic,adLockOptimistic

Printer.EndDoc
Printer.PaperSize = 17
Printer.PaperBin = intTray5
Printer.FontSize = 24
Printer.Font = "Courier"
Printer.FontBold = True
rsDrawList.MoveFirst
Do Until rsDrawList.EOF
Printer.Print rsDrawList
rsDrawList.MoveNext
Loop
Printer.EndDoc


am i doing this right? also is it possible to be able to make columns and drop certain parts of the recordset into each column?


thanks
 
I think the error is in your printer.print statement - you have to specify the field that you are trying to print: Printer.Print rsDrawList.Fields("FieldName").value or Printer.Print rsDrawList!FieldName. You can put data into columns on the paper by using tabs (I'm sure there's more ways to do it, but I think this is the easiest) - Just use Printer.Print "hello" & Tab(20) & "world". Also, I'd recommend running a couple of basic searches first.
-Max
 
i commented out the bin property and i got past that property error.. it goes thru and looks like its populating all the fields correctly, but nothing comes out of the printer.???? any ideas of what im missing for it to print.


rsDrawList.Open strsql,g_Conn,adOpenDynamic,adLockOptimistic

Printer.EndDoc
Printer.PaperSize = 17
'Printer.PaperBin = intTray5
Printer.FontSize = 24
Printer.Font = "Courier"
Printer.FontBold = True
rsDrawList.MoveFirst
Printer.Print "Date: " & rsDrawList.Fields(0)

Do Until rsDrawList.EOF
Printer.Print "Work Order"; Tab(20); "Drawing"; Tab(20); "Found/Not Found"
If rsDrawList(3) = "Y" Then
Printer.Print rsDrawList.Fields(0); Tab(20);
rsDrawList.Fields(2); Tab(20); "Found"
Else
Printer.Print rsDrawList.Fields(0); Tab(20); rsDrawList.Fields(2); Tab(20); "Not Found"
End If


rsDrawList.MoveNext
Loop
 
i was told to do that at start and finish, to make sure nothing is hanging out there.. is that correct or ??
 
i typed in this:

Printer.Print "Testing 1-2-3"
Printer.EndDoc



and it worked..

not sure why my code not printing it.. i commented out the printer.enddoc at the beginning out.

now im clueless
 
Dont u have to say rs.MoveFirst or so at the start before the loop?

rsDrawList.MoveFirst

Do Until rsDrawList.EOF
 
Thanks all for your help. the code was right. but it was reading thru my printer list and printing at another printer at another site. i changed the default printer and it is working!!!

:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top