Results 1 to 2 of 2

Thread: Need to print report like in Access97. Want to Use VB. How?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154

    Post

    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

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width