-
I am converting an Access Database to VB5. There is a report that gets printed in Access that I need to do in VB. Is there an easy way to mimick what access97 does with a report? If so how? I am currently working on creating a form and printing the form. Unless, I find otherwise, I will keep going down this path.
Thanks
-
Your Best bet is to write a class module that holds data for one field eg where to put it, the Font, the field etc as properties and one property which is the target form or picturebox.
with a method to put its field on the target, something along the lines of
Code:
Dim propTarget as Object
Dim propField as Field
Dim propFont as stdFont
Dim propX as single
Dim propY as single
'put Code For these properties in here
Public Sub PutonTarget()
propTarget.CurrentX=propX
propTarget.CurrentY=PropY
set propTarget.Font=propFont
propTarget.Print propField.Value
End Sub
then Set up the class modules from your code remembering to set all their targets to the form or picture box and add them to a collection
then loop the recordset from yuor form code and for every record in the recordset clear the form loop through your collection with a for Each loop and envoke the PutOnTarget method of all your fields then print the form or picturebox using its printform method and go to the next record.
I've done something like this before and this is the way I did it but I don't have the code to hand and I'm a bit rusty on Databases.
Hope this helps