I have a form, a datagrid, and a print button. How can I use code to connect to database to display some fields in a table, and click print button to print the content in the datagrid use the printer. Thanks.
Printable View
I have a form, a datagrid, and a print button. How can I use code to connect to database to display some fields in a table, and click print button to print the content in the datagrid use the printer. Thanks.
To connect to a db you'll need to use a data control, i believe you can either use that of DAO or ADO, and set the RecordSource property of the grid to the name of the data control. At least, this is the easy way. Another way is with code, while having the DataMode property of the grid to 'unbound' but this requires lots coding.
I am not sure about printing...
But, if you need to have comprehensive documentation on DBgrid, you can visit www.apexsc.com (maker of DBGrid) to download the "DBGrid Survilval Kit"
Hope this helps