Solved

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

Posted on 1998-08-13
1
128 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

691 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