Solved

How to print the content of a MS Access file using VB?

Posted on 1998-08-13
1
127 Views
Last Modified: 2010-04-30
I have to write a programme which update the table in a MS Access file...after that, I have to print out the content (ie. the table) using the printer...How could I do that?
that's urgent...
0
Comment
Question by:michaeleu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
waty earned 20 total points
ID: 1468693
Here a solution :

dim rs     as RecordSet
dim nI     as integer
dim sData  as string

gsSeparator = " | "

set rs = DB.OpenRecordSet("Select * from Table")

Do while rs.EOF=false
   sData = ""
   For nI = 0 To rs.Fields.Count - 1
      sData = sData & CStr(record.Fields(nI)) & gsSeparator
   Next

   if Len(sData) > 0 then
      sData = Left(sData, len(sData) - len(gsSeparator))
   end if

   printer.print sData

   rs.MoveNExt
loop

Printer.EndDocument


Otherwise, you could use my Print Preview. You can find it on my web site. It can generate reports based on a database.

http://www.geocities.com/ResearchTriangle/6311/
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using web browser with BING 40 136
Passing a Text Box name to a Sub 6 102
backup program with robocopy 6 74
VBA: loop recent folder and copy txt file. 8 51
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question