kgermann
asked on
Printing an access database from visual basic
I would like to print a tabel from my access database in visual basic. I really don't no how to do it so please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The other way to do this is as follows:
(You'll need to make sure there is a reference to the data objects)
Dim dbData As Database
Dim rsTable As Recordset
Dim nCnt1 As Integer
Set dbData = OpenDatabase("c:\mds\data\ MDSTables. mdb")
Set rsTable = dbData.OpenRecordset("Past e Errors")
For nCnt1 = 0 To rsTable.Fields.Count - 1
Printer.Print rsTable.Fields(nCnt1).Name ; vbTab;
Next nCnt1
Printer.Print
Do Until rsTable.EOF
For nCnt1 = 0 To rsTable.Fields.Count - 1
Printer.Print rsTable.Fields(nCnt1); vbTab;
Next nCnt1
Printer.Print
rsTable.MoveNext
Loop
Printer.EndDoc
(You'll need to make sure there is a reference to the data objects)
Dim dbData As Database
Dim rsTable As Recordset
Dim nCnt1 As Integer
Set dbData = OpenDatabase("c:\mds\data\
Set rsTable = dbData.OpenRecordset("Past
For nCnt1 = 0 To rsTable.Fields.Count - 1
Printer.Print rsTable.Fields(nCnt1).Name
Next nCnt1
Printer.Print
Do Until rsTable.EOF
For nCnt1 = 0 To rsTable.Fields.Count - 1
Printer.Print rsTable.Fields(nCnt1); vbTab;
Next nCnt1
Printer.Print
rsTable.MoveNext
Loop
Printer.EndDoc
ASKER
The code is working fine, but it is only the text from the tabel I am getting. I would like the linies also.
thanks for your help
thanks for your help
I'm not sure what you mean by "linies". Can you explain?
ASKER
What I mean is that, I would like to see the printing as a tabel they way I do it in access. I hope you understand.
Kasper Germann
Kasper Germann
You might want to start with the printer object.
Hope this helps.