Link to home
Start Free TrialLog in
Avatar of kgermann
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.
Avatar of jjbyers
jjbyers

Do you just want a dump to the printer or formatting?

You might want to start with the printer object.

Hope this helps.
ASKER CERTIFIED SOLUTION
Avatar of clifABB
clifABB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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("Paste 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

Avatar of kgermann

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
I'm not sure what you mean by "linies".  Can you explain?
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