I have written an ADO-based front-end to an MS Access database. The database is displayed in a datagrid format. After the user makes a query, the resulting "hits" are displayed in the datagrid. Next, the user clicks on each record (row in the datagrid) that he wants to print out. Then he clicks the Print button. Here is the code that is activated:
Now, here is the problem: the marked records (rows) are not printed.
Any suggestions would be very much appreciated.
Thanks
Code:
Public Sub Print_Click()
Dim rst As Recordset
Dim varRecords As Variant
Dim intRows As Integer
Dim intNumReturned As Integer, intNumFields As Integer
Dim intField As Integer, intRecord As Integer
Printer.Print ""
Printer.FontName = "Arial"
Printer.FontSize = 12
Printer.FontBold = False
intRows = grdDataGrid.SelBookmarks.Count - 1
Set rst = datPrimaryRS.Recordset
varRecords = rst.GetRows(intRows)
intNumReturned = UBound(varRecords, 2)
intNumFields = UBound(varRecords, 1)
For intRecord = 0 To intNumReturned
For intField = 0 To intNumFields
Printer.Print varRecords(intField, intRecord)
Next intField
Printer.Print
Next intRecord
Printer.EndDoc
intRows = 0
End Sub
Now, here is the problem: the marked records (rows) are not printed.
Any suggestions would be very much appreciated.
Thanks