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

Printing Datagrid 1

Status
Not open for further replies.

Catrina

Programmer
Feb 11, 2000
70
US
I need to code a command button to print out the contents of a datagrid. any ideas?

Thanks Catrina
 
If you want the current contents etc of the grid to print you can use the PrintForm method of the form containing the grid.
If you want to print the contents of the underlying datasource you can set the datasource at the beginning using the MoveFirst method, print the fields you desire, use MoveNext, then loop. For example: and assuming you are using a data control as the recordsource of the datagrid.

data1.MoveFirst
For loops = 1 to data1.recordset.recordcount
print data1.recordset![field1]
'where field1 is the field name
.
.
print data1.recordset![fieldx]
data1.MoveNext
next

note the use of the member access operator "!".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top