|
-
Apr 14th, 2005, 02:30 PM
#1
Thread Starter
Addicted Member
<resolved> Querry and print
Hello guys
I have run into an unusual problem, so I am trying to find an alternative solution instead of figuring out what I did wrong originally.
<b>Here is the question:</b>
I have an Access 2000 table with records of tickets. Each record has the following columns:
Id(long integer)-----Style(Text)-------RequestNo(Long Integer)-----PO(Long Int.)
I need to querry this table for all tickets with specific RequestNo and print all the tickets one after another.
What is the best way to do this.
I am using the following code to querry. HOw do I get the print thing to work?
VB Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "B22"
cn.Open
rs.Open "SELECT Id, Style,RQN,PO FROM Rolls WHERE RQN = " & CLng(Trim(txtKRid.Text)) & " ORDER BY Id", cn, adOpenKeyset, adLockOptimistic, adCmdText
' Print thing should probably happen here.
rs.close
cn.close
Last edited by SaharaWizard; Apr 14th, 2005 at 03:39 PM.
Don't let your schooling get in the way of your education.
-
Apr 14th, 2005, 03:09 PM
#2
Re: Querry and print
This should work:
Code:
rs.Open "SELECT Id, Style,RQN,PO FROM Rolls WHERE RQN = " & CLng(Trim(txtKRid.Text)) & " ORDER BY Id", cn, adOpenKeyset, adLockOptimistic, adCmdText
' Print thing should probably happen here.
Printer.Font = "Times New Roman"
Printer.FontSize = 20
Printer.FontBold = True
Printer.Print "Heading Goes Here"
Printer.Print ""
Printer.FontSize = 10
Printer.FontBold = False
Do While Not rs.EOF
Printer.CurrentX = 100
Printer.Print rs(0);
Printer.CurrentX = 2000
Printer.Print rs(1);
Printer.CurrenX = 4000
Printer.Print rs(2);
Printer.CurrentX = 6000
Printer.Print rs(3)
rs.MoveNext
Loop
rs.close
-
Apr 14th, 2005, 03:38 PM
#3
Thread Starter
Addicted Member
U 's them genuses
U is them genuses ma boy, u's them geniuses!!
Your code solved the 2-day problem. (I just added a printer.enddoc before the move next thing).
Thanks a million
If you are ever in Canada email me beers are on me!
Don't let your schooling get in the way of your education.
-
Apr 14th, 2005, 03:46 PM
#4
Re: <resolved> Querry and print
No problem - the PRINTER object is your friend!
In the past 3 years we have developed our own in-house report writer that is much, much better than Crystal and it's free!
Plus we can customize it for the oddest needs - which is what custom software is all about!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|