Click to See Complete Forum and Search --> : DBgrid printing??
Thenrich
Nov 22nd, 1999, 08:32 PM
Does anybody know if there is a way to print just the information in a DBgrid from a form and not the complete form??
Aaron Young
Nov 22nd, 1999, 08:58 PM
You could just print the Info from the Underlying DataSource which the Grid is Bound to, eg.
Private Sub Command1_Click()
Dim sLine As String
Dim iIndex As Integer
With Data1.Recordset
.MoveFirst
While Not .EOF
sLine = ""
For iIndex = 0 To .Fields.Count - 1
sLine = sLine & Chr(9) & .Fields(iIndex)
Next
Printer.Print Mid$(sLine, 2)
.MoveNext
Wend
End With
Printer.EndDoc
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
MartinLiss
Nov 22nd, 1999, 10:37 PM
If you just want to see the info that is currently being displayed in your grid and you have a "Print" button on the form, you can put code behind that button to temporarily make everything except the grid .Visible = False, and then make them visible again when printing is done.
------------------
Marty
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.