borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (uv curing- not an advertisment)Next Topic (printing) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Printing recordsets
Poster Message
Pedro
Level: Guest


icon Printing recordsets

how do i print data within a recordset?  I've been told that i can only use a data report, how do i use them?

im using DAO

01-05-2003 at 10:47 AM
| Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305
icon Re: Printing recordsets

You can use code to print data held within a recordset.

All you have to do is set up a loop which prints the particular pieces of information you require, the theory is like this:-

Data1.refresh
Data1.recordset.movelast

TotalRecords=Data1.recordset.recordcount

Data1.recordset.movefirst

Printer.Fontname="TimesNewRoman"
Printer.Fontsize=10

For x = 1 to TotalRecords

Printout1=data1.recordset("Myfield1")
Printout2=data1.recordset("Myfield2")

Printer.Print Printout1
Printer.Print Printout2
Printer.Print

Data1.recordset.movenext

Next x

Hope this is what you are after

Regards

Shady


[Edited by Shady on 06-06-2003 at 02:26 PM GMT]

____________________________
I don't wanna die... but I ain't keen on livin' either

04-06-2003 at 11:39 AM
View Profile Send Email to User Show All Posts | Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: Printing recordsets

Obviously, you don't have to use a Data Report...

However, regarding Data Reports, they aren't that friendly unless you also use a Data Environment...which aren't that friendly either...lol...

you can use a Data Report without a DE, like I said...not so friendly...this is some code i had laying around...

'Code in DataReport_Initialize() event
'Need to set Con before trying this next line...
sql="Select FieldName from TableName"
rs.open sql,Con,adopenDynamic,adlockoptimistic

set datareport.datasource=rs

'And use this to change ONE text fields value...
datareport.sections("Section1").controls ("txtDatafield").datafield=rs(0).name


____________________________
Eggheads unite! You have nothing to lose but your yolks.

06-06-2003 at 03:37 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Printing : Printing recordsets
Previous Topic (uv curing- not an advertisment)Next Topic (printing) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder