473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Printing Tables from visual basic please important for school

Is there any code to print all the records in table from visual basic and with out using any wizards please its very important for my project
thanks
Feb 20 '07 #1
9 3934
hariharanmca
1,977 1GB
Is there any code to print all the records in table from visual basic and with out using any wizards please its very important for my project
thanks

Could you be more specific?
Feb 20 '07 #2
Could you be more specific?
Ok i have an access database which contains tables lets say contains:
security table & Customers table .....
and i want to print the security table all the fields in it ,
thats the best i can explain and thx for replying
Feb 20 '07 #3
Killer42
8,435 Expert 8TB
Ok i have an access database which contains tables lets say contains:
security table & Customers table .....
and i want to print the security table all the fields in it ,
thats the best i can explain and thx for replying
Do you have any code to read the table? Just read through the table and for each of the records, use the Printer object to print all the fields you're interested in.

I'm assuming you're using VB6. Please let us know whether this is correct.
Feb 21 '07 #4
Do you have any code to read the table? Just read through the table and for each of the records, use the Printer object to print all the fields you're interested in.

I'm assuming you're using VB6. Please let us know whether this is correct.
oh sorry yes iam using vb6 and my skill isnt this high . and i dun kno what u meant but is this going to print all the table ?
thanks
Feb 24 '07 #5
Try this code you should connect the printer on lpt1 to get the printout

Expand|Select|Wrap|Line Numbers
  1. Dim rs As New ADODB.Recordset
  2. Open "Lpt1:" For Output As #1
  3. rs.Open "Select * from Table1", conn, adOpenForwardOnly, adLockReadOnly
  4. Do While Not rs.EOF
  5.     For i = 0 To rs.Fields.Count - 1
  6.         Print #1, rs.Fields(i).Value & ""
  7.     Next i
  8.     rs.MoveNext
  9. Loop
  10. rs.Close
  11. Close #1
Feb 25 '07 #6
Killer42
8,435 Expert 8TB
Try this code you should connect the printer on lpt1 to get the printout...
Thanks for the sample. However, it would be a better idea generally to use the Printer object rather than writing directly to LPT1.
Feb 25 '07 #7
Tell me how to use printer object

is it like this

Expand|Select|Wrap|Line Numbers
  1. for ----- 
  2. Printer.Print rs.fields(i)
  3. next ---
  4. and finally 
  5. printer.EndDoc 
Feb 25 '07 #8
Killer42
8,435 Expert 8TB
...is it like this
Expand|Select|Wrap|Line Numbers
  1. for ----- 
  2.   Printer.Print rs.fields(i)
  3. next ---
  4. and finally 
  5. printer.EndDoc
Yes. But the Print statement, and other features of the Printer object, also allow you to do much more. You can position things and format things in all sorts of ways.

For example, a slight enhancement to your code...
Expand|Select|Wrap|Line Numbers
  1. for ----- 
  2.   Printer.Print rs.fields(i).Name; " : "; rs.fields(i).Value
  3. next ---
I'd recommend that you read up on the Printer object in the documentation, for more info.
Feb 25 '07 #9
sorry i couldnt connect to the internet i got a proplem...... Thanks for the codes i will try and thankss again
Mar 1 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robin Powers | last post by:
PROCESS CONTROLS/VISUAL BASIC PROGRAMMERS SALARY: TO $100,000 LOCATION: LOS ANGELES AREA Our Client has recently acquired process automation systems used to monitor and control their...
2
by: Karl E. Taylor | last post by:
Could someone point me in the direction of a good example of coding report printing from database tables through VB? I have 5 tables that I need to run a report from. They are actually very...
40
by: Mason A. Clark | last post by:
CSS Experts: OK, I'm a stupid newby. Now, here's the question: Can CSS replace slightly complicated Tables and work in three browsers (e.g. MSIE 6.0, Net 7.1, Op 7.03) ? After countless...
33
by: John Timbers | last post by:
I'd like to purchase Visual C# .Net for learning purposes only since it's a lot cheaper than Visual Studio (note that I'm a very experienced C++ developer). Can someone simply clarify the basic...
5
by: K. Shier | last post by:
when attempting to edit code in a class file, i see the bug "Visual Basic ..NET compiler is unable to recover from the following error: System Error &Hc0000005&(Visual Basic internal compiler...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
10
by: yansong1990 | last post by:
well ok, im pretty new to c++, i have -a lot- of exp in programming in VBA (visual basic for app) for excel to make macros so i picked up a new course for computing which handles c++ only, i...
5
hussaini
by: hussaini | last post by:
please tell me any 1 printing code in datagrid in visual basic 6 in detail ----- Hello seniors members hope u will tell me ..... i have created a form in visual basic 6 so in the form there is a...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.